{
 "metadata": {
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.9"
  },
  "orig_nbformat": 2,
  "kernelspec": {
   "name": "python3",
   "display_name": "Python 3",
   "language": "python"
  },
  "metadata": {
   "interpreter": {
    "hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6"
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2,
 "cells": [
  {
   "source": [
    "# Causal Discovery example\n",
    "\n",
    "The goal of this notebook is to show how causal discovery methods can work with DoWhy. We use discovery methods from [Causal Discovery Tool (CDT)](https://github.com/FenTechSolutions/CausalDiscoveryToolbox) repo. As we will see, causal discovery methods are not fool-proof and there is no guarantee that they will recover the correct causal graph. Even for the simple examples below, there is a large variance in results. These methods, however, may be combined usefully with domain knowledge to construct the final causal graph."
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "output_type": "stream",
     "name": "stdout",
     "text": [
      "The rpy2.ipython extension is already loaded. To reload it, use:\n  %reload_ext rpy2.ipython\n"
     ]
    }
   ],
   "source": [
    "import dowhy\n",
    "from dowhy import CausalModel\n",
    "\n",
    "from rpy2.robjects import r as R\n",
    "%load_ext rpy2.ipython\n",
    "\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "import graphviz\n",
    "import networkx as nx \n",
    "\n",
    "np.set_printoptions(precision=3, suppress=True)\n",
    "np.random.seed(0)"
   ]
  },
  {
   "source": [
    "## Utility function\n",
    "We define a utility function to draw the directed acyclic graph."
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "def make_graph(adjacency_matrix, labels=None):\n",
    "    idx = np.abs(adjacency_matrix) > 0.01\n",
    "    dirs = np.where(idx)\n",
    "    d = graphviz.Digraph(engine='dot')\n",
    "    names = labels if labels else [f'x{i}' for i in range(len(adjacency_matrix))]\n",
    "    for name in names:\n",
    "        d.node(name)\n",
    "    for to, from_, coef in zip(dirs[0], dirs[1], adjacency_matrix[idx]):\n",
    "        d.edge(names[from_], names[to], label=str(coef))\n",
    "    return d\n",
    "\n",
    "def str_to_dot(string):\n",
    "    '''\n",
    "    Converts input string from graphviz library to valid DOT graph format.\n",
    "    '''\n",
    "    graph = string.replace('\\n', ';').replace('\\t','')\n",
    "    graph = graph[:9] + graph[10:-2] + graph[-1] # Removing unnecessary characters from string\n",
    "    return graph"
   ]
  },
  {
   "source": [
    "# Experiments on the Auto-MPG dataset\n",
    "\n",
    "In this section, we will use a dataset on the technical specification of cars. The dataset is downloaded from UCI Machine Learning Repository. The dataset contains 9 attributes and 398 instances. We do not know the true causal graph for the dataset and will use CDT to discover it. The causal graph obtained will then be used to estimate the causal effect.\n"
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "source": [
    "## 1. Load the data"
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "output_type": "stream",
     "name": "stdout",
     "text": [
      "(392, 6)\n"
     ]
    },
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "    mpg  cylinders  displacement  horsepower  weight  acceleration\n",
       "0  18.0        8.0         307.0       130.0  3504.0          12.0\n",
       "1  15.0        8.0         350.0       165.0  3693.0          11.5\n",
       "2  18.0        8.0         318.0       150.0  3436.0          11.0\n",
       "3  16.0        8.0         304.0       150.0  3433.0          12.0\n",
       "4  17.0        8.0         302.0       140.0  3449.0          10.5"
      ],
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>mpg</th>\n      <th>cylinders</th>\n      <th>displacement</th>\n      <th>horsepower</th>\n      <th>weight</th>\n      <th>acceleration</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>18.0</td>\n      <td>8.0</td>\n      <td>307.0</td>\n      <td>130.0</td>\n      <td>3504.0</td>\n      <td>12.0</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>15.0</td>\n      <td>8.0</td>\n      <td>350.0</td>\n      <td>165.0</td>\n      <td>3693.0</td>\n      <td>11.5</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>18.0</td>\n      <td>8.0</td>\n      <td>318.0</td>\n      <td>150.0</td>\n      <td>3436.0</td>\n      <td>11.0</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>16.0</td>\n      <td>8.0</td>\n      <td>304.0</td>\n      <td>150.0</td>\n      <td>3433.0</td>\n      <td>12.0</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>17.0</td>\n      <td>8.0</td>\n      <td>302.0</td>\n      <td>140.0</td>\n      <td>3449.0</td>\n      <td>10.5</td>\n    </tr>\n  </tbody>\n</table>\n</div>"
     },
     "metadata": {},
     "execution_count": 14
    }
   ],
   "source": [
    "data_mpg = pd.read_csv('http://archive.ics.uci.edu/ml/machine-learning-databases/auto-mpg/auto-mpg.data-original',\n",
    "                   delim_whitespace=True, header=None,\n",
    "                   names = ['mpg', 'cylinders', 'displacement',\n",
    "                            'horsepower', 'weight', 'acceleration',\n",
    "                            'model year', 'origin', 'car name'])\n",
    "data_mpg.dropna(inplace=True)\n",
    "data_mpg.drop(['model year', 'origin', 'car name'], axis=1, inplace=True)\n",
    "print(data_mpg.shape)\n",
    "data_mpg.head()"
   ]
  },
  {
   "source": [
    "# Causal Discovery with Causal Discovery Tool (CDT)\n",
    "\n",
    "We use the CDT library to perform causal discovery on the Auto-MPG dataset. We use three methods for causal discovery here -LiNGAM, PC and GES. These methods are widely used and do not take much time to run. Hence, these are ideal for an introduction to the topic. Other neural network based methods are also available in CDT and the users are encouraged to try them out by themselves. \n",
    "\n",
    "The documentation for the methods used are as follows:\n",
    "- LiNGAM [[link]](https://fentechsolutions.github.io/CausalDiscoveryToolbox/html/_modules/cdt/causality/graph/LiNGAM.html)\n",
    "- PC [[link]](https://fentechsolutions.github.io/CausalDiscoveryToolbox/html/_modules/cdt/causality/graph/PC.html)\n",
    "- GES [[link]](https://fentechsolutions.github.io/CausalDiscoveryToolbox/html/_modules/cdt/causality/graph/GES.html)"
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "output_type": "stream",
     "name": "stdout",
     "text": [
      "Method : LiNGAM\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": "<graphviz.dot.Digraph at 0x7fef9e2b4f98>",
      "image/svg+xml": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<!-- Generated by graphviz version 2.40.1 (20161225.0304)\n -->\n<!-- Title: %3 Pages: 1 -->\n<svg width=\"839pt\" height=\"392pt\"\n viewBox=\"0.00 0.00 839.18 392.00\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 388)\">\n<title>%3</title>\n<polygon fill=\"#ffffff\" stroke=\"transparent\" points=\"-4,4 -4,-388 835.1759,-388 835.1759,4 -4,4\"/>\n<!-- mpg -->\n<g id=\"node1\" class=\"node\">\n<title>mpg</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"98.1759\" cy=\"-279\" rx=\"31.3957\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"98.1759\" y=\"-275.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">mpg</text>\n</g>\n<!-- displacement -->\n<g id=\"node3\" class=\"node\">\n<title>displacement</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"306.1759\" cy=\"-105\" rx=\"73.387\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"306.1759\" y=\"-101.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">displacement</text>\n</g>\n<!-- mpg&#45;&gt;displacement -->\n<g id=\"edge2\" class=\"edge\">\n<title>mpg&#45;&gt;displacement</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M99.4049,-260.688C101.9651,-237.2961 109.8565,-197.0849 134.1759,-174 163.1845,-146.4639 204.5783,-129.4002 239.4887,-119.1313\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"240.4702,-122.4911 249.1475,-116.4121 238.5732,-115.7531 240.4702,-122.4911\"/>\n<text text-anchor=\"middle\" x=\"206.6759\" y=\"-188.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">&#45;2.03256227570648</text>\n</g>\n<!-- horsepower -->\n<g id=\"node4\" class=\"node\">\n<title>horsepower</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"457.1759\" cy=\"-192\" rx=\"65.7887\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"457.1759\" y=\"-188.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">horsepower</text>\n</g>\n<!-- mpg&#45;&gt;horsepower -->\n<g id=\"edge5\" class=\"edge\">\n<title>mpg&#45;&gt;horsepower</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M103.3333,-260.9144C107.5616,-249.5428 114.7498,-235.6259 126.1759,-228 136.7874,-220.9177 290.2189,-206.4796 384.413,-198.2015\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"384.8071,-201.6805 394.4638,-197.3218 384.1967,-194.7072 384.8071,-201.6805\"/>\n<text text-anchor=\"middle\" x=\"198.6759\" y=\"-231.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">&#45;2.34003517426168</text>\n</g>\n<!-- weight -->\n<g id=\"node5\" class=\"node\">\n<title>weight</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"434.1759\" cy=\"-18\" rx=\"42.4939\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"434.1759\" y=\"-14.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">weight</text>\n</g>\n<!-- mpg&#45;&gt;weight -->\n<g id=\"edge8\" class=\"edge\">\n<title>mpg&#45;&gt;weight</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M77.549,-265.2463C42.1045,-239.9222 -23.5404,-184.5273 9.1759,-141 54.5758,-80.5977 281.2135,-40.389 383.7015,-25.0109\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"384.4297,-28.4413 393.8093,-23.5145 383.4045,-21.5168 384.4297,-28.4413\"/>\n<text text-anchor=\"middle\" x=\"81.6759\" y=\"-144.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">&#45;33.5886541842027</text>\n</g>\n<!-- cylinders -->\n<g id=\"node2\" class=\"node\">\n<title>cylinders</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"371.1759\" cy=\"-366\" rx=\"53.8905\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"371.1759\" y=\"-362.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">cylinders</text>\n</g>\n<!-- cylinders&#45;&gt;mpg -->\n<g id=\"edge1\" class=\"edge\">\n<title>cylinders&#45;&gt;mpg</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M318.8711,-361.5199C248.8404,-355.0833 131.5726,-342.6011 116.1759,-330 109.1254,-324.2297 104.8337,-315.5069 102.2223,-306.8986\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"105.5924,-305.9424 99.864,-297.0297 98.7841,-307.5693 105.5924,-305.9424\"/>\n<text text-anchor=\"middle\" x=\"197.6759\" y=\"-318.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">&#45;2.8898048266414906</text>\n</g>\n<!-- cylinders&#45;&gt;displacement -->\n<g id=\"edge3\" class=\"edge\">\n<title>cylinders&#45;&gt;displacement</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M354.814,-348.5688C335.0258,-326.1699 302.801,-285.1269 290.1759,-243 279.0758,-205.9621 288.1523,-161.1949 296.4884,-132.9035\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"299.8566,-133.859 299.4873,-123.2706 293.173,-131.7782 299.8566,-133.859\"/>\n<text text-anchor=\"middle\" x=\"364.6759\" y=\"-231.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">36.00486769513329</text>\n</g>\n<!-- cylinders&#45;&gt;horsepower -->\n<g id=\"edge6\" class=\"edge\">\n<title>cylinders&#45;&gt;horsepower</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M383.4597,-348.4375C399.2047,-325.2406 426.4594,-282.6763 443.1759,-243 446.215,-235.7867 448.7825,-227.7219 450.8555,-220.1727\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"454.2868,-220.8817 453.3737,-210.3263 447.5051,-219.1473 454.2868,-220.8817\"/>\n<text text-anchor=\"middle\" x=\"505.1759\" y=\"-275.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">6.11319623482435</text>\n</g>\n<!-- acceleration -->\n<g id=\"node6\" class=\"node\">\n<title>acceleration</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"681.1759\" cy=\"-279\" rx=\"68.4888\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"681.1759\" y=\"-275.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">acceleration</text>\n</g>\n<!-- cylinders&#45;&gt;acceleration -->\n<g id=\"edge12\" class=\"edge\">\n<title>cylinders&#45;&gt;acceleration</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M412.6622,-354.3571C467.2054,-339.0498 563.2613,-312.0922 624.4805,-294.9113\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"625.6854,-298.2084 634.3677,-292.1365 623.7939,-291.4688 625.6854,-298.2084\"/>\n<text text-anchor=\"middle\" x=\"626.6759\" y=\"-318.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">&#45;0.6444826283484151</text>\n</g>\n<!-- displacement&#45;&gt;weight -->\n<g id=\"edge9\" class=\"edge\">\n<title>displacement&#45;&gt;weight</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M316.5252,-86.9718C323.4701,-76.1984 333.4733,-62.9178 345.1759,-54 358.0083,-44.2212 373.8608,-36.6905 388.6148,-31.1059\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"389.8701,-34.3741 398.1089,-27.7129 387.5143,-27.7824 389.8701,-34.3741\"/>\n<text text-anchor=\"middle\" x=\"415.1759\" y=\"-57.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">4.39362650060749</text>\n</g>\n<!-- horsepower&#45;&gt;displacement -->\n<g id=\"edge4\" class=\"edge\">\n<title>horsepower&#45;&gt;displacement</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M402.6716,-181.9097C372.4278,-175.3624 338.6556,-166.174 327.1759,-156 320.377,-149.9745 315.7332,-141.4104 312.581,-133.0169\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"315.8905,-131.8745 309.5259,-123.4044 309.2193,-133.9948 315.8905,-131.8745\"/>\n<text text-anchor=\"middle\" x=\"406.1759\" y=\"-144.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">0.7667635984364591</text>\n</g>\n<!-- horsepower&#45;&gt;weight -->\n<g id=\"edge10\" class=\"edge\">\n<title>horsepower&#45;&gt;weight</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M474.6032,-174.3522C478.8993,-168.9041 482.9146,-162.5906 485.1759,-156 499.8882,-113.1204 506.0321,-94.2508 485.1759,-54 481.8928,-47.664 476.9248,-42.2058 471.3557,-37.5929\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"473.0381,-34.4886 462.8926,-31.4357 468.9198,-40.149 473.0381,-34.4886\"/>\n<text text-anchor=\"middle\" x=\"573.6759\" y=\"-101.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">8.579361620973849</text>\n</g>\n<!-- acceleration&#45;&gt;horsepower -->\n<g id=\"edge7\" class=\"edge\">\n<title>acceleration&#45;&gt;horsepower</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M628.7068,-267.3653C618.8981,-265.2236 608.7288,-263.0254 599.1759,-261 560.123,-252.7201 546.5984,-261.4098 511.1759,-243 498.897,-236.6184 487.4236,-226.6253 478.238,-217.1699\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"480.7548,-214.7365 471.3902,-209.7813 475.6208,-219.4949 480.7548,-214.7365\"/>\n<text text-anchor=\"middle\" x=\"588.1759\" y=\"-231.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">&#45;4.847239645491821</text>\n</g>\n<!-- acceleration&#45;&gt;weight -->\n<g id=\"edge11\" class=\"edge\">\n<title>acceleration&#45;&gt;weight</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M684.1782,-260.8674C689.2654,-223.5322 695.2086,-137.3618 652.1759,-87 630.1592,-61.2336 540.5308,-39.1429 483.2771,-27.2872\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"483.8333,-23.8287 473.3361,-25.2638 482.4371,-30.6881 483.8333,-23.8287\"/>\n<text text-anchor=\"middle\" x=\"756.6759\" y=\"-144.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">57.96805587384421</text>\n</g>\n</g>\n</svg>\n"
     },
     "metadata": {}
    },
    {
     "output_type": "stream",
     "name": "stdout",
     "text": [
      "Method : PC\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": "<graphviz.dot.Digraph at 0x7fef98251b00>",
      "image/svg+xml": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<!-- Generated by graphviz version 2.40.1 (20161225.0304)\n -->\n<!-- Title: %3 Pages: 1 -->\n<svg width=\"408pt\" height=\"305pt\"\n viewBox=\"0.00 0.00 408.44 305.00\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 301)\">\n<title>%3</title>\n<polygon fill=\"#ffffff\" stroke=\"transparent\" points=\"-4,4 -4,-301 404.4435,-301 404.4435,4 -4,4\"/>\n<!-- mpg -->\n<g id=\"node1\" class=\"node\">\n<title>mpg</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"307.4435\" cy=\"-279\" rx=\"31.3957\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"307.4435\" y=\"-275.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">mpg</text>\n</g>\n<!-- horsepower -->\n<g id=\"node4\" class=\"node\">\n<title>horsepower</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"222.4435\" cy=\"-192\" rx=\"65.7887\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"222.4435\" y=\"-188.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">horsepower</text>\n</g>\n<!-- mpg&#45;&gt;horsepower -->\n<g id=\"edge7\" class=\"edge\">\n<title>mpg&#45;&gt;horsepower</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M279.2788,-270.8794C264.5533,-265.2782 247.3695,-256.3815 236.4435,-243 231.1355,-236.4991 227.8332,-228.1386 225.7809,-220.0753\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"229.1947,-219.2976 223.7931,-210.1831 222.3319,-220.6767 229.1947,-219.2976\"/>\n<text text-anchor=\"middle\" x=\"247.9435\" y=\"-231.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- weight -->\n<g id=\"node5\" class=\"node\">\n<title>weight</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"217.4435\" cy=\"-18\" rx=\"42.4939\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"217.4435\" y=\"-14.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">weight</text>\n</g>\n<!-- mpg&#45;&gt;weight -->\n<g id=\"edge10\" class=\"edge\">\n<title>mpg&#45;&gt;weight</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M312.9263,-261.1098C322.7165,-225.6598 339.5915,-144.9205 310.4435,-87 299.0795,-64.4185 276.442,-47.3733 256.3474,-35.8738\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"257.8009,-32.6803 247.3432,-30.9805 254.4584,-38.8308 257.8009,-32.6803\"/>\n<text text-anchor=\"middle\" x=\"338.9435\" y=\"-144.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- cylinders -->\n<g id=\"node2\" class=\"node\">\n<title>cylinders</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"91.4435\" cy=\"-18\" rx=\"53.8905\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"91.4435\" y=\"-14.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">cylinders</text>\n</g>\n<!-- displacement -->\n<g id=\"node3\" class=\"node\">\n<title>displacement</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"73.4435\" cy=\"-105\" rx=\"73.387\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"73.4435\" y=\"-101.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">displacement</text>\n</g>\n<!-- cylinders&#45;&gt;displacement -->\n<g id=\"edge4\" class=\"edge\">\n<title>cylinders&#45;&gt;displacement</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M87.7186,-36.0034C85.2821,-47.7801 82.0483,-63.4102 79.2747,-76.8156\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"75.7718,-76.4718 77.1731,-86.9735 82.6266,-77.8901 75.7718,-76.4718\"/>\n<text text-anchor=\"middle\" x=\"95.9435\" y=\"-57.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- displacement&#45;&gt;cylinders -->\n<g id=\"edge3\" class=\"edge\">\n<title>displacement&#45;&gt;cylinders</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M58.048,-87.0172C51.5885,-77.2297 46.5789,-64.9228 51.4435,-54 53.4746,-49.4393 56.4007,-45.214 59.7596,-41.3828\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"62.4771,-43.6172 67.1141,-34.091 57.5485,-38.6463 62.4771,-43.6172\"/>\n<text text-anchor=\"middle\" x=\"62.9435\" y=\"-57.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- displacement&#45;&gt;horsepower -->\n<g id=\"edge8\" class=\"edge\">\n<title>displacement&#45;&gt;horsepower</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M102.1046,-121.735C125.8915,-135.624 159.8762,-155.4674 185.667,-170.5265\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"184.0172,-173.6161 194.4177,-175.636 187.5469,-167.5711 184.0172,-173.6161\"/>\n<text text-anchor=\"middle\" x=\"168.9435\" y=\"-144.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- displacement&#45;&gt;weight -->\n<g id=\"edge11\" class=\"edge\">\n<title>displacement&#45;&gt;weight</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M101.2081,-88.2255C124.7918,-73.9771 158.7134,-53.4828 183.8289,-38.3088\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"185.8988,-41.1475 192.648,-32.9806 182.2789,-35.1561 185.8988,-41.1475\"/>\n<text text-anchor=\"middle\" x=\"165.9435\" y=\"-57.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- horsepower&#45;&gt;mpg -->\n<g id=\"edge1\" class=\"edge\">\n<title>horsepower&#45;&gt;mpg</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M243.3884,-209.4063C249.9817,-215.143 257.1747,-221.6764 263.4435,-228 271.6789,-236.3074 280.1964,-245.9095 287.5182,-254.526\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"285.0188,-256.9927 294.1234,-262.4108 290.3847,-252.4976 285.0188,-256.9927\"/>\n<text text-anchor=\"middle\" x=\"288.9435\" y=\"-231.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- horsepower&#45;&gt;displacement -->\n<g id=\"edge5\" class=\"edge\">\n<title>horsepower&#45;&gt;displacement</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M164.4595,-183.5206C143.5956,-178.2552 120.9187,-169.7433 103.4435,-156 95.6162,-149.8443 89.4152,-141.0378 84.7311,-132.4707\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"87.815,-130.8112 80.2386,-123.4052 81.5429,-133.9194 87.815,-130.8112\"/>\n<text text-anchor=\"middle\" x=\"114.9435\" y=\"-144.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- acceleration -->\n<g id=\"node6\" class=\"node\">\n<title>acceleration</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"233.4435\" cy=\"-105\" rx=\"68.4888\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"233.4435\" y=\"-101.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">acceleration</text>\n</g>\n<!-- horsepower&#45;&gt;acceleration -->\n<g id=\"edge12\" class=\"edge\">\n<title>horsepower&#45;&gt;acceleration</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M207.4706,-174.1934C201.1349,-164.4576 196.1088,-152.1437 200.4435,-141 201.9227,-137.1973 204.012,-133.552 206.4296,-130.1395\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"209.3225,-132.1314 212.9555,-122.1789 203.909,-127.6935 209.3225,-132.1314\"/>\n<text text-anchor=\"middle\" x=\"211.9435\" y=\"-144.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- weight&#45;&gt;mpg -->\n<g id=\"edge2\" class=\"edge\">\n<title>weight&#45;&gt;mpg</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M257.0739,-24.4081C289.6574,-30.5281 332.2222,-40.771 343.4435,-54 397.7803,-118.0587 379.9745,-167.3595 343.4435,-243 340.993,-248.074 337.5305,-252.8534 333.712,-257.1702\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"331.1132,-254.8211 326.5959,-264.4046 336.1036,-259.7299 331.1132,-254.8211\"/>\n<text text-anchor=\"middle\" x=\"388.9435\" y=\"-144.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- weight&#45;&gt;displacement -->\n<g id=\"edge6\" class=\"edge\">\n<title>weight&#45;&gt;displacement</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M210.4678,-35.8596C205.3384,-46.8449 197.3563,-60.4158 186.4435,-69 173.7791,-78.962 158.2978,-86.1974 142.9054,-91.4425\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"141.8404,-88.1083 133.3588,-94.4576 143.9486,-94.7833 141.8404,-88.1083\"/>\n<text text-anchor=\"middle\" x=\"211.9435\" y=\"-57.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- acceleration&#45;&gt;horsepower -->\n<g id=\"edge9\" class=\"edge\">\n<title>acceleration&#45;&gt;horsepower</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M231.1672,-123.0034C229.6782,-134.7801 227.702,-150.4102 226.007,-163.8156\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"222.5048,-163.6135 224.7227,-173.9735 229.4495,-164.4916 222.5048,-163.6135\"/>\n<text text-anchor=\"middle\" x=\"240.9435\" y=\"-144.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n</g>\n</svg>\n"
     },
     "metadata": {}
    },
    {
     "output_type": "stream",
     "name": "stdout",
     "text": [
      "Method : GES\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": "<graphviz.dot.Digraph at 0x7fef98266cc0>",
      "image/svg+xml": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<!-- Generated by graphviz version 2.40.1 (20161225.0304)\n -->\n<!-- Title: %3 Pages: 1 -->\n<svg width=\"467pt\" height=\"218pt\"\n viewBox=\"0.00 0.00 467.42 218.00\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 214)\">\n<title>%3</title>\n<polygon fill=\"#ffffff\" stroke=\"transparent\" points=\"-4,4 -4,-214 463.4185,-214 463.4185,4 -4,4\"/>\n<!-- mpg -->\n<g id=\"node1\" class=\"node\">\n<title>mpg</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"181.4185\" cy=\"-192\" rx=\"31.3957\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"181.4185\" y=\"-188.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">mpg</text>\n</g>\n<!-- displacement -->\n<g id=\"node3\" class=\"node\">\n<title>displacement</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"227.4185\" cy=\"-105\" rx=\"73.387\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"227.4185\" y=\"-101.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">displacement</text>\n</g>\n<!-- mpg&#45;&gt;displacement -->\n<g id=\"edge5\" class=\"edge\">\n<title>mpg&#45;&gt;displacement</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M176.0731,-174.0969C174.0413,-163.8792 173.2913,-151.1292 178.4185,-141 180.8297,-136.2364 184.2008,-131.9499 188.0585,-128.1379\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"190.6242,-130.5492 195.952,-121.3913 186.0762,-125.228 190.6242,-130.5492\"/>\n<text text-anchor=\"middle\" x=\"189.9185\" y=\"-144.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- horsepower -->\n<g id=\"node4\" class=\"node\">\n<title>horsepower</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"74.4185\" cy=\"-18\" rx=\"65.7887\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"74.4185\" y=\"-14.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">horsepower</text>\n</g>\n<!-- mpg&#45;&gt;horsepower -->\n<g id=\"edge10\" class=\"edge\">\n<title>mpg&#45;&gt;horsepower</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M151.9298,-185.6141C121.8753,-177.215 77.7052,-159.0749 63.4185,-123 53.5723,-98.1378 58.5215,-67.511 64.6001,-45.765\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"67.9602,-46.7452 67.5189,-36.1595 61.2626,-44.7099 67.9602,-46.7452\"/>\n<text text-anchor=\"middle\" x=\"74.9185\" y=\"-101.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- weight -->\n<g id=\"node5\" class=\"node\">\n<title>weight</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"375.4185\" cy=\"-18\" rx=\"42.4939\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"375.4185\" y=\"-14.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">weight</text>\n</g>\n<!-- mpg&#45;&gt;weight -->\n<g id=\"edge13\" class=\"edge\">\n<title>mpg&#45;&gt;weight</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M205.6735,-180.2426C210.8039,-177.995 216.2355,-175.7886 221.4185,-174 253.0066,-163.0989 266.4332,-174.2611 294.4185,-156 335.2906,-129.3299 339.6611,-112.6857 361.4185,-69 365.0046,-61.7996 367.7759,-53.5545 369.87,-45.823\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"373.2755,-46.6308 372.2444,-36.0862 366.4748,-44.9723 373.2755,-46.6308\"/>\n<text text-anchor=\"middle\" x=\"362.9185\" y=\"-101.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- cylinders -->\n<g id=\"node2\" class=\"node\">\n<title>cylinders</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"229.4185\" cy=\"-18\" rx=\"53.8905\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"229.4185\" y=\"-14.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">cylinders</text>\n</g>\n<!-- cylinders&#45;&gt;displacement -->\n<g id=\"edge6\" class=\"edge\">\n<title>cylinders&#45;&gt;displacement</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M212.2845,-35.2777C207.8784,-40.8091 203.7312,-47.2596 201.4185,-54 198.5902,-62.243 200.75,-70.8227 204.8125,-78.5414\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"201.9548,-80.5703 210.2707,-87.135 207.8637,-76.8172 201.9548,-80.5703\"/>\n<text text-anchor=\"middle\" x=\"212.9185\" y=\"-57.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- displacement&#45;&gt;mpg -->\n<g id=\"edge1\" class=\"edge\">\n<title>displacement&#45;&gt;mpg</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M220.4555,-123.3145C216.4661,-133.1992 211.1261,-145.4931 205.4185,-156 203.4968,-159.5375 201.3279,-163.1716 199.0995,-166.7069\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"196.1004,-164.8978 193.5444,-175.1797 201.9544,-168.7359 196.1004,-164.8978\"/>\n<text text-anchor=\"middle\" x=\"223.9185\" y=\"-144.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- displacement&#45;&gt;cylinders -->\n<g id=\"edge4\" class=\"edge\">\n<title>displacement&#45;&gt;cylinders</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M227.8329,-86.9735C228.1037,-75.1918 228.4631,-59.5607 228.7712,-46.1581\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"232.2738,-46.0812 229.0046,-36.0034 225.2756,-45.9202 232.2738,-46.0812\"/>\n<text text-anchor=\"middle\" x=\"240.9185\" y=\"-57.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- displacement&#45;&gt;horsepower -->\n<g id=\"edge11\" class=\"edge\">\n<title>displacement&#45;&gt;horsepower</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M170.3649,-93.5786C151.777,-88.1115 131.7435,-80.2245 115.4185,-69 105.9124,-62.4639 97.4966,-53.0885 90.802,-44.1548\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"93.5555,-41.9862 84.9314,-35.8319 87.8353,-46.021 93.5555,-41.9862\"/>\n<text text-anchor=\"middle\" x=\"126.9185\" y=\"-57.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- displacement&#45;&gt;weight -->\n<g id=\"edge14\" class=\"edge\">\n<title>displacement&#45;&gt;weight</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M270.8096,-90.3935C285.4619,-84.6514 301.5972,-77.4057 315.4185,-69 328.0774,-61.3012 340.7713,-50.9808 351.2018,-41.6381\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"353.7071,-44.0892 358.6989,-34.744 348.9689,-38.9366 353.7071,-44.0892\"/>\n<text text-anchor=\"middle\" x=\"348.9185\" y=\"-57.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- horsepower&#45;&gt;mpg -->\n<g id=\"edge2\" class=\"edge\">\n<title>horsepower&#45;&gt;mpg</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M48.6838,-34.7774C32.4686,-47.0316 13.0264,-65.2644 4.4185,-87 -1.4728,-101.8759 -1.4728,-108.1241 4.4185,-123 11.8279,-141.7093 18.048,-145.8411 35.4185,-156 67.8131,-174.9456 109.8621,-183.9655 140.5089,-188.233\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"140.0706,-191.7054 150.4346,-189.5056 140.9609,-184.7622 140.0706,-191.7054\"/>\n<text text-anchor=\"middle\" x=\"15.9185\" y=\"-101.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- horsepower&#45;&gt;displacement -->\n<g id=\"edge7\" class=\"edge\">\n<title>horsepower&#45;&gt;displacement</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M103.1889,-34.3596C127.6185,-48.251 162.8626,-68.2917 189.5759,-83.4817\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"187.8572,-86.5306 198.2802,-88.4312 191.3174,-80.4456 187.8572,-86.5306\"/>\n<text text-anchor=\"middle\" x=\"171.9185\" y=\"-57.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- weight&#45;&gt;mpg -->\n<g id=\"edge3\" class=\"edge\">\n<title>weight&#45;&gt;mpg</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M382.084,-36.0722C383.8598,-41.7317 385.5303,-48.0535 386.4185,-54 393.418,-100.8609 392.717,-126.7809 355.4185,-156 308.1148,-193.057 279.1987,-157.4981 221.4185,-174 219.1325,-174.6529 216.8092,-175.4142 214.4917,-176.2478\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"213.1005,-173.0345 205.1077,-179.9891 215.6929,-179.5368 213.1005,-173.0345\"/>\n<text text-anchor=\"middle\" x=\"400.9185\" y=\"-101.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- weight&#45;&gt;displacement -->\n<g id=\"edge8\" class=\"edge\">\n<title>weight&#45;&gt;displacement</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M342.946,-29.8359C327.2196,-36.1247 308.3412,-44.5145 292.4185,-54 279.3293,-61.7975 265.9119,-71.9043 254.6919,-81.0617\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"252.3887,-78.425 246.9465,-87.5153 256.8697,-83.8029 252.3887,-78.425\"/>\n<text text-anchor=\"middle\" x=\"303.9185\" y=\"-57.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- acceleration -->\n<g id=\"node6\" class=\"node\">\n<title>acceleration</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"298.4185\" cy=\"-192\" rx=\"68.4888\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"298.4185\" y=\"-188.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">acceleration</text>\n</g>\n<!-- acceleration&#45;&gt;displacement -->\n<g id=\"edge9\" class=\"edge\">\n<title>acceleration&#45;&gt;displacement</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M284.0506,-174.3943C273.8211,-161.8595 259.9109,-144.8147 248.4368,-130.7548\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"251.0431,-128.4127 242.0087,-122.8782 245.6198,-132.8386 251.0431,-128.4127\"/>\n<text text-anchor=\"middle\" x=\"278.9185\" y=\"-144.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- acceleration&#45;&gt;horsepower -->\n<g id=\"edge12\" class=\"edge\">\n<title>acceleration&#45;&gt;horsepower</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M248.5407,-179.5825C219.2355,-171.9523 185.2946,-162.4389 171.4185,-156 147.6016,-144.9483 139.6009,-142.8531 122.4185,-123 102.8538,-100.3944 89.7929,-68.4862 82.2987,-45.7896\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"85.5827,-44.5654 79.2437,-36.0761 78.9052,-46.6655 85.5827,-44.5654\"/>\n<text text-anchor=\"middle\" x=\"133.9185\" y=\"-101.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- acceleration&#45;&gt;weight -->\n<g id=\"edge15\" class=\"edge\">\n<title>acceleration&#45;&gt;weight</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M350.8694,-180.4108C376.8767,-173.7594 404.7596,-164.9662 414.4185,-156 447.6432,-125.158 440.0277,-91.4069 414.4185,-54 411.2953,-49.438 407.4937,-45.0369 403.5034,-40.9718\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"405.8834,-38.4053 396.2226,-34.0556 401.0623,-43.4805 405.8834,-38.4053\"/>\n<text text-anchor=\"middle\" x=\"447.9185\" y=\"-101.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n</g>\n</svg>\n"
     },
     "metadata": {}
    }
   ],
   "source": [
    "from cdt.causality.graph import LiNGAM, PC, GES\n",
    "\n",
    "graphs = {}\n",
    "labels = [f'{col}' for i, col in enumerate(data_mpg.columns)]\n",
    "functions = {\n",
    "    'LiNGAM' : LiNGAM,\n",
    "    'PC' : PC,\n",
    "    'GES' : GES,\n",
    "}\n",
    "\n",
    "for method, lib in functions.items():\n",
    "    obj = lib()\n",
    "    output = obj.predict(data_mpg)\n",
    "    adj_matrix = nx.to_numpy_matrix(output)\n",
    "    adj_matrix = np.asarray(adj_matrix)\n",
    "    graph_dot = make_graph(adj_matrix, labels)\n",
    "    graphs[method] = graph_dot\n",
    "\n",
    "# Visualize graphs\n",
    "for method, graph in graphs.items():\n",
    "    print(\"Method : %s\"%(method))\n",
    "    display(graph)"
   ]
  },
  {
   "source": [
    "As you can see, no two methods agree on the graphs. PC and GES effectively produce an undirected graph whereas LiNGAM produces a directed graph. In the absence of directed edges, the causal effect can be obtained for PC and GES for the Auto-MPG dataset. This can be observed in the next section."
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "source": [
    "## Estimate causal effects using Linear Regression\n",
    "\n",
    "Now let us see whether these differences in the graphs also lead to signficant differences in the causal estimate of effect of *mpg* on *weight*."
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "output_type": "stream",
     "name": "stdout",
     "text": [
      "\n",
      "*****************************************************************************\n",
      "\n",
      "Causal Discovery Method : LiNGAM\n",
      "Estimand type: nonparametric-ate\n",
      "\n",
      "### Estimand : 1\n",
      "Estimand name: backdoor\n",
      "Estimand expression:\n",
      "  d                                               \n",
      "──────(Expectation(weight|cylinders,acceleration))\n",
      "d[mpg]                                            \n",
      "Estimand assumption 1, Unconfoundedness: If U→{mpg} and U→weight then P(weight|mpg,cylinders,acceleration,U) = P(weight|mpg,cylinders,acceleration)\n",
      "\n",
      "### Estimand : 2\n",
      "Estimand name: iv\n",
      "No such variable found!\n",
      "\n",
      "### Estimand : 3\n",
      "Estimand name: frontdoor\n",
      "No such variable found!\n",
      "\n",
      "Causal Estimate is -39.56010817288552\n",
      "\n",
      "*****************************************************************************\n",
      "\n",
      "Causal Discovery Method : PC\n",
      "Estimand type: nonparametric-ate\n",
      "\n",
      "### Estimand : 1\n",
      "Estimand name: backdoor\n",
      "No such variable found!\n",
      "\n",
      "### Estimand : 2\n",
      "Estimand name: iv\n",
      "No such variable found!\n",
      "\n",
      "### Estimand : 3\n",
      "Estimand name: frontdoor\n",
      "No such variable found!\n",
      "\n",
      "Causal Estimate is None\n",
      "\n",
      "*****************************************************************************\n",
      "\n",
      "Causal Discovery Method : GES\n",
      "Estimand type: nonparametric-ate\n",
      "\n",
      "### Estimand : 1\n",
      "Estimand name: backdoor\n",
      "No such variable found!\n",
      "\n",
      "### Estimand : 2\n",
      "Estimand name: iv\n",
      "No such variable found!\n",
      "\n",
      "### Estimand : 3\n",
      "Estimand name: frontdoor\n",
      "No such variable found!\n",
      "\n",
      "Causal Estimate is None\n"
     ]
    }
   ],
   "source": [
    "for method, graph in graphs.items():\n",
    "        print('\\n*****************************************************************************\\n')\n",
    "        print(\"Causal Discovery Method : %s\"%(method))\n",
    "\n",
    "        # Obtain valid dot format\n",
    "        graph_dot = str_to_dot(graph.source)\n",
    "\n",
    "        # Define Causal Model\n",
    "        model=CausalModel(\n",
    "                data = data_mpg,\n",
    "                treatment='mpg',\n",
    "                outcome='weight',\n",
    "                graph=graph_dot)\n",
    "\n",
    "        # Identification\n",
    "        identified_estimand = model.identify_effect(proceed_when_unidentifiable=True)\n",
    "        print(identified_estimand)\n",
    "        \n",
    "        # Estimation\n",
    "        estimate = model.estimate_effect(identified_estimand,\n",
    "                                        method_name=\"backdoor.linear_regression\",\n",
    "                                        control_value=0,\n",
    "                                        treatment_value=1,\n",
    "                                        confidence_intervals=True,\n",
    "                                        test_significance=True)\n",
    "        print(\"Causal Estimate is \" + str(estimate.value))"
   ]
  },
  {
   "source": [
    "As mentioned earlier, due to the absence of directed edges, no backdoor, instrmental or frontdoor variables can be found out for PC and GES. Thus, causal effect estimation is not possible for these methods. However, LiNGAM does discover a DAG and hence, its possible to output a causal estimate for LiNGAM. The estimate is still pretty far from the original estimate of -70.466 (which can be calculated from the graph)."
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "source": [
    "# Experiments on the Sachs dataset\n",
    "\n",
    "The dataset consists of the simultaneous measurements of 11 phosphorylated proteins and phospholipids derived from thousands of individual primary immune system cells, subjected to both general and specific molecular interventions (Sachs et al., 2005).\n",
    "\n",
    "The specifications of the dataset are as follows - \n",
    "- Number of nodes: 11\n",
    "- Number of arcs: 17\n",
    "- Number of parameters: 178\n",
    "- Average Markov blanket size: 3.09\n",
    "- Average degree: 3.09\n",
    "- Maximum in-degree: 3\n",
    "- Number of instances: 7466\n",
    "\n",
    "The original causal graph is known for the Sachs dataset and we compare the original graph with the ones discovered using CDT in this section."
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "source": [
    "## 1. Load the data"
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "output_type": "stream",
     "name": "stdout",
     "text": [
      "(7466, 11)\n"
     ]
    },
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "   praf  pmek   plcg   PIP2   PIP3  p44/42  pakts473    PKA    PKC   P38  pjnk\n",
       "0  26.4  13.2   8.82  18.30  58.80    6.61      17.0  414.0  17.00  44.9  40.0\n",
       "1  35.9  16.5  12.30  16.80   8.13   18.60      32.5  352.0   3.37  16.5  61.5\n",
       "2  59.4  44.1  14.60  10.20  13.00   14.90      32.5  403.0  11.40  31.9  19.5\n",
       "3  73.0  82.8  23.10  13.50   1.29    5.83      11.8  528.0  13.70  28.6  23.1\n",
       "4  33.7  19.8   5.19   9.73  24.80   21.10      46.1  305.0   4.66  25.7  81.3"
      ],
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>praf</th>\n      <th>pmek</th>\n      <th>plcg</th>\n      <th>PIP2</th>\n      <th>PIP3</th>\n      <th>p44/42</th>\n      <th>pakts473</th>\n      <th>PKA</th>\n      <th>PKC</th>\n      <th>P38</th>\n      <th>pjnk</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>26.4</td>\n      <td>13.2</td>\n      <td>8.82</td>\n      <td>18.30</td>\n      <td>58.80</td>\n      <td>6.61</td>\n      <td>17.0</td>\n      <td>414.0</td>\n      <td>17.00</td>\n      <td>44.9</td>\n      <td>40.0</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>35.9</td>\n      <td>16.5</td>\n      <td>12.30</td>\n      <td>16.80</td>\n      <td>8.13</td>\n      <td>18.60</td>\n      <td>32.5</td>\n      <td>352.0</td>\n      <td>3.37</td>\n      <td>16.5</td>\n      <td>61.5</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>59.4</td>\n      <td>44.1</td>\n      <td>14.60</td>\n      <td>10.20</td>\n      <td>13.00</td>\n      <td>14.90</td>\n      <td>32.5</td>\n      <td>403.0</td>\n      <td>11.40</td>\n      <td>31.9</td>\n      <td>19.5</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>73.0</td>\n      <td>82.8</td>\n      <td>23.10</td>\n      <td>13.50</td>\n      <td>1.29</td>\n      <td>5.83</td>\n      <td>11.8</td>\n      <td>528.0</td>\n      <td>13.70</td>\n      <td>28.6</td>\n      <td>23.1</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>33.7</td>\n      <td>19.8</td>\n      <td>5.19</td>\n      <td>9.73</td>\n      <td>24.80</td>\n      <td>21.10</td>\n      <td>46.1</td>\n      <td>305.0</td>\n      <td>4.66</td>\n      <td>25.7</td>\n      <td>81.3</td>\n    </tr>\n  </tbody>\n</table>\n</div>"
     },
     "metadata": {},
     "execution_count": 17
    }
   ],
   "source": [
    "from cdt.data import load_dataset\n",
    "data_sachs, graph_sachs = load_dataset(\"sachs\")\n",
    "\n",
    "data_sachs.dropna(inplace=True)\n",
    "print(data_sachs.shape)\n",
    "data_sachs.head()"
   ]
  },
  {
   "source": [
    "## Ground truth of the causal graph"
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "output_type": "display_data",
     "data": {
      "text/plain": "<graphviz.dot.Digraph at 0x7fef982101d0>",
      "image/svg+xml": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<!-- Generated by graphviz version 2.40.1 (20161225.0304)\n -->\n<!-- Title: %3 Pages: 1 -->\n<svg width=\"480pt\" height=\"566pt\"\n viewBox=\"0.00 0.00 480.21 566.00\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 562)\">\n<title>%3</title>\n<polygon fill=\"#ffffff\" stroke=\"transparent\" points=\"-4,4 -4,-562 476.2132,-562 476.2132,4 -4,4\"/>\n<!-- praf -->\n<g id=\"node1\" class=\"node\">\n<title>praf</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"149.0159\" cy=\"-192\" rx=\"29.795\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"149.0159\" y=\"-188.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">praf</text>\n</g>\n<!-- plcg -->\n<g id=\"node3\" class=\"node\">\n<title>plcg</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"218.0159\" cy=\"-105\" rx=\"30.5947\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"218.0159\" y=\"-101.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">plcg</text>\n</g>\n<!-- praf&#45;&gt;plcg -->\n<g id=\"edge7\" class=\"edge\">\n<title>praf&#45;&gt;plcg</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M158.4334,-174.7782C164.3559,-164.5549 172.4744,-151.5685 181.0159,-141 184.8415,-136.2666 189.241,-131.5113 193.6407,-127.0788\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"196.2095,-129.463 200.944,-119.9848 191.3322,-124.4418 196.2095,-129.463\"/>\n<text text-anchor=\"middle\" x=\"192.5159\" y=\"-144.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- pmek -->\n<g id=\"node2\" class=\"node\">\n<title>pmek</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"149.0159\" cy=\"-279\" rx=\"36.2938\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"149.0159\" y=\"-275.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">pmek</text>\n</g>\n<!-- pmek&#45;&gt;praf -->\n<g id=\"edge1\" class=\"edge\">\n<title>pmek&#45;&gt;praf</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M149.0159,-260.9735C149.0159,-249.1918 149.0159,-233.5607 149.0159,-220.1581\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"152.516,-220.0033 149.0159,-210.0034 145.516,-220.0034 152.516,-220.0033\"/>\n<text text-anchor=\"middle\" x=\"160.5159\" y=\"-231.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- pmek&#45;&gt;plcg -->\n<g id=\"edge8\" class=\"edge\">\n<title>pmek&#45;&gt;plcg</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M163.2891,-262.12C167.7563,-256.3071 172.4457,-249.5957 176.0159,-243 195.2336,-207.4969 206.9025,-161.9864 212.9093,-133.1495\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"216.3442,-133.8209 214.8696,-123.3292 209.4797,-132.4506 216.3442,-133.8209\"/>\n<text text-anchor=\"middle\" x=\"214.5159\" y=\"-188.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- PIP2 -->\n<g id=\"node4\" class=\"node\">\n<title>PIP2</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"218.0159\" cy=\"-18\" rx=\"33.2948\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"218.0159\" y=\"-14.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">PIP2</text>\n</g>\n<!-- plcg&#45;&gt;PIP2 -->\n<g id=\"edge9\" class=\"edge\">\n<title>plcg&#45;&gt;PIP2</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M218.0159,-86.9735C218.0159,-75.1918 218.0159,-59.5607 218.0159,-46.1581\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"221.516,-46.0033 218.0159,-36.0034 214.516,-46.0034 221.516,-46.0033\"/>\n<text text-anchor=\"middle\" x=\"229.5159\" y=\"-57.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- PIP2&#45;&gt;praf -->\n<g id=\"edge2\" class=\"edge\">\n<title>PIP2&#45;&gt;praf</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M198.5108,-32.9224C183.6686,-45.5344 164.2694,-65.0234 155.0159,-87 144.772,-111.329 144.1848,-141.6669 145.6144,-163.4673\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"142.1504,-164.0435 146.4748,-173.7156 149.1258,-163.4578 142.1504,-164.0435\"/>\n<text text-anchor=\"middle\" x=\"166.5159\" y=\"-101.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- PIP3 -->\n<g id=\"node5\" class=\"node\">\n<title>PIP3</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"256.0159\" cy=\"-366\" rx=\"33.2948\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"256.0159\" y=\"-362.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">PIP3</text>\n</g>\n<!-- PIP3&#45;&gt;pmek -->\n<g id=\"edge3\" class=\"edge\">\n<title>PIP3&#45;&gt;pmek</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M231.9066,-353.622C220.5178,-347.2642 207.0379,-338.9735 196.0159,-330 186.4363,-322.2008 176.9864,-312.4619 169.1008,-303.5905\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"171.5269,-301.045 162.3399,-295.7678 166.2308,-305.6223 171.5269,-301.045\"/>\n<text text-anchor=\"middle\" x=\"207.5159\" y=\"-318.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- pakts473 -->\n<g id=\"node7\" class=\"node\">\n<title>pakts473</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"306.0159\" cy=\"-279\" rx=\"53.8905\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"306.0159\" y=\"-275.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">pakts473</text>\n</g>\n<!-- PIP3&#45;&gt;pakts473 -->\n<g id=\"edge11\" class=\"edge\">\n<title>PIP3&#45;&gt;pakts473</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M265.8943,-348.8116C272.9915,-336.4624 282.6932,-319.5816 290.7786,-305.513\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"293.8665,-307.1642 295.8148,-296.75 287.7974,-303.6761 293.8665,-307.1642\"/>\n<text text-anchor=\"middle\" x=\"295.5159\" y=\"-318.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- p44/42 -->\n<g id=\"node6\" class=\"node\">\n<title>p44/42</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"162.0159\" cy=\"-366\" rx=\"42.7926\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"162.0159\" y=\"-362.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">p44/42</text>\n</g>\n<!-- p44/42&#45;&gt;pmek -->\n<g id=\"edge4\" class=\"edge\">\n<title>p44/42&#45;&gt;pmek</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M154.8189,-347.9604C152.8848,-342.3023 151.0454,-335.973 150.0159,-330 148.7482,-322.6446 148.2068,-314.6046 148.0509,-307.1279\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"151.5508,-307.0637 148.0517,-297.0634 144.5508,-307.0631 151.5508,-307.0637\"/>\n<text text-anchor=\"middle\" x=\"161.5159\" y=\"-318.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- p44/42&#45;&gt;pakts473 -->\n<g id=\"edge12\" class=\"edge\">\n<title>p44/42&#45;&gt;pakts473</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M186.7704,-351.0442C209.9327,-337.0503 244.7741,-316.0003 270.8232,-300.2623\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"272.8876,-303.1043 279.6369,-294.9374 269.2678,-297.1129 272.8876,-303.1043\"/>\n<text text-anchor=\"middle\" x=\"254.5159\" y=\"-318.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- PKA -->\n<g id=\"node8\" class=\"node\">\n<title>PKA</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"71.0159\" cy=\"-366\" rx=\"30.5947\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"71.0159\" y=\"-362.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">PKA</text>\n</g>\n<!-- PKA&#45;&gt;pmek -->\n<g id=\"edge5\" class=\"edge\">\n<title>PKA&#45;&gt;pmek</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M60.0478,-348.7157C54.9033,-338.2223 51.2351,-324.9747 58.0159,-315 68.396,-299.7308 86.3616,-290.938 103.6021,-285.8745\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"104.7924,-289.1825 113.6064,-283.3035 103.05,-282.4028 104.7924,-289.1825\"/>\n<text text-anchor=\"middle\" x=\"69.5159\" y=\"-318.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- PKA&#45;&gt;pakts473 -->\n<g id=\"edge13\" class=\"edge\">\n<title>PKA&#45;&gt;pakts473</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M83.4094,-349.1507C92.7405,-337.7197 106.5426,-323.2395 122.0159,-315 133.1035,-309.0959 197.7213,-297.2226 247.2817,-288.7255\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"248.0181,-292.1505 257.2881,-287.0204 246.8422,-285.25 248.0181,-292.1505\"/>\n<text text-anchor=\"middle\" x=\"133.5159\" y=\"-318.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- PKC -->\n<g id=\"node9\" class=\"node\">\n<title>PKC</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"248.0159\" cy=\"-453\" rx=\"30.5947\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"248.0159\" y=\"-449.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">PKC</text>\n</g>\n<!-- PKC&#45;&gt;pmek -->\n<g id=\"edge6\" class=\"edge\">\n<title>PKC&#45;&gt;pmek</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M217.9609,-448.8658C159.3854,-440.1273 33.4433,-417.7677 8.0159,-384 -24.3239,-341.0525 54.5971,-307.4952 106.9783,-290.7392\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"108.2249,-294.0171 116.7384,-287.7108 106.1504,-287.3315 108.2249,-294.0171\"/>\n<text text-anchor=\"middle\" x=\"19.5159\" y=\"-362.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- PKC&#45;&gt;pakts473 -->\n<g id=\"edge14\" class=\"edge\">\n<title>PKC&#45;&gt;pakts473</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M262.5421,-436.8677C273.7818,-423.5712 288.9176,-403.7519 298.0159,-384 311.0719,-355.6562 313.1676,-346.1319 311.0159,-315 310.8408,-312.4663 310.5972,-309.8394 310.3109,-307.2112\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"313.7797,-306.7437 309.05,-297.2632 306.8353,-307.6239 313.7797,-306.7437\"/>\n<text text-anchor=\"middle\" x=\"322.5159\" y=\"-362.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- PKC&#45;&gt;PKA -->\n<g id=\"edge17\" class=\"edge\">\n<title>PKC&#45;&gt;PKA</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M224.5117,-441.4471C193.5673,-426.2371 138.9954,-399.4136 103.9487,-382.1873\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"105.1358,-378.8709 94.6174,-377.6007 102.0479,-385.153 105.1358,-378.8709\"/>\n<text text-anchor=\"middle\" x=\"182.5159\" y=\"-405.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- P38 -->\n<g id=\"node10\" class=\"node\">\n<title>P38</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"312.0159\" cy=\"-540\" rx=\"28.6953\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"312.0159\" y=\"-536.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">P38</text>\n</g>\n<!-- P38&#45;&gt;pakts473 -->\n<g id=\"edge15\" class=\"edge\">\n<title>P38&#45;&gt;pakts473</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M318.0952,-522.1916C328.8881,-488.1993 349.2507,-411.7703 338.0159,-348 335.4235,-333.2847 328.8707,-318.097 322.3652,-305.7297\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"325.3703,-303.9315 317.466,-296.8766 319.2456,-307.3209 325.3703,-303.9315\"/>\n<text text-anchor=\"middle\" x=\"352.5159\" y=\"-405.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- P38&#45;&gt;PKC -->\n<g id=\"edge18\" class=\"edge\">\n<title>P38&#45;&gt;PKC</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M299.978,-523.636C290.4736,-510.7159 277.0574,-492.4783 266.2383,-477.771\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"268.9625,-475.5677 260.2175,-469.5865 263.3239,-479.7157 268.9625,-475.5677\"/>\n<text text-anchor=\"middle\" x=\"295.5159\" y=\"-492.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- pjnk -->\n<g id=\"node11\" class=\"node\">\n<title>pjnk</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"441.0159\" cy=\"-366\" rx=\"31.3957\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"441.0159\" y=\"-362.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">pjnk</text>\n</g>\n<!-- pjnk&#45;&gt;PIP2 -->\n<g id=\"edge10\" class=\"edge\">\n<title>pjnk&#45;&gt;PIP2</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M442.9806,-348.0296C444.7304,-330.4548 447.0159,-302.9213 447.0159,-279 447.0159,-279 447.0159,-279 447.0159,-105 447.0159,-65.4377 326.0675,-37.429 259.9681,-25.076\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"260.3237,-21.5831 249.8574,-23.2285 259.0654,-28.4691 260.3237,-21.5831\"/>\n<text text-anchor=\"middle\" x=\"458.5159\" y=\"-188.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- pjnk&#45;&gt;pakts473 -->\n<g id=\"edge16\" class=\"edge\">\n<title>pjnk&#45;&gt;pakts473</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M426.6142,-349.7695C416.3619,-338.9135 401.8273,-324.8641 387.0159,-315 376.303,-307.8653 363.9438,-301.5499 352.1578,-296.2799\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"353.4398,-293.0214 342.8708,-292.282 350.672,-299.4509 353.4398,-293.0214\"/>\n<text text-anchor=\"middle\" x=\"416.5159\" y=\"-318.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n</g>\n</svg>\n"
     },
     "metadata": {}
    }
   ],
   "source": [
    "labels = [f'{col}' for i, col in enumerate(data_sachs.columns)]\n",
    "adj_matrix = nx.to_numpy_matrix(graph_sachs)\n",
    "adj_matrix = np.asarray(adj_matrix)\n",
    "graph_dot = make_graph(adj_matrix, labels)\n",
    "display(graph_dot)"
   ]
  },
  {
   "source": [
    "# Causal Discovery with Causal Discovery Tool (CDT)\n",
    "\n",
    "We use the CDT library to perform causal discovery on the Auto-MPG dataset. We use three methods for causal discovery here -LiNGAM, PC and GES. These methods are widely used and do not take much time to run. Hence, these are ideal for an introduction to the topic. Other neural network based methods are also available in CDT and the users the encourages to try them out by themselves. \n",
    "\n",
    "The documentation for the methods used in as follows:\n",
    "- LiNGAM [[link]](https://fentechsolutions.github.io/CausalDiscoveryToolbox/html/_modules/cdt/causality/graph/LiNGAM.html)\n",
    "- PC [[link]](https://fentechsolutions.github.io/CausalDiscoveryToolbox/html/_modules/cdt/causality/graph/PC.html)\n",
    "- GES [[link]](https://fentechsolutions.github.io/CausalDiscoveryToolbox/html/_modules/cdt/causality/graph/GES.html)"
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "output_type": "stream",
     "name": "stdout",
     "text": [
      "Method : LiNGAM\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": "<graphviz.dot.Digraph at 0x7fef9e2cedd8>",
      "image/svg+xml": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<!-- Generated by graphviz version 2.40.1 (20161225.0304)\n -->\n<!-- Title: %3 Pages: 1 -->\n<svg width=\"904pt\" height=\"218pt\"\n viewBox=\"0.00 0.00 904.40 218.00\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 214)\">\n<title>%3</title>\n<polygon fill=\"#ffffff\" stroke=\"transparent\" points=\"-4,4 -4,-214 900.3968,-214 900.3968,4 -4,4\"/>\n<!-- praf -->\n<g id=\"node1\" class=\"node\">\n<title>praf</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"36.3968\" cy=\"-192\" rx=\"29.795\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"36.3968\" y=\"-188.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">praf</text>\n</g>\n<!-- pmek -->\n<g id=\"node2\" class=\"node\">\n<title>pmek</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"36.3968\" cy=\"-105\" rx=\"36.2938\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"36.3968\" y=\"-101.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">pmek</text>\n</g>\n<!-- praf&#45;&gt;pmek -->\n<g id=\"edge1\" class=\"edge\">\n<title>praf&#45;&gt;pmek</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M36.3968,-173.9735C36.3968,-162.1918 36.3968,-146.5607 36.3968,-133.1581\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"39.8969,-133.0033 36.3968,-123.0034 32.8969,-133.0034 39.8969,-133.0033\"/>\n<text text-anchor=\"middle\" x=\"115.3968\" y=\"-144.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">0.8643793158466808</text>\n</g>\n<!-- plcg -->\n<g id=\"node3\" class=\"node\">\n<title>plcg</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"217.3968\" cy=\"-192\" rx=\"30.5947\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"217.3968\" y=\"-188.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">plcg</text>\n</g>\n<!-- PIP2 -->\n<g id=\"node4\" class=\"node\">\n<title>PIP2</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"307.3968\" cy=\"-105\" rx=\"33.2948\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"307.3968\" y=\"-101.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">PIP2</text>\n</g>\n<!-- plcg&#45;&gt;PIP2 -->\n<g id=\"edge2\" class=\"edge\">\n<title>plcg&#45;&gt;PIP2</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M213.14,-173.9887C211.7118,-163.4855 211.8676,-150.4822 218.3968,-141 229.0642,-125.5078 247.6219,-116.6786 265.0403,-111.6484\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"266.2602,-114.9501 275.0961,-109.1041 264.5431,-108.164 266.2602,-114.9501\"/>\n<text text-anchor=\"middle\" x=\"297.3968\" y=\"-144.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.7589781213856999</text>\n</g>\n<!-- PIP3 -->\n<g id=\"node5\" class=\"node\">\n<title>PIP3</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"398.3968\" cy=\"-192\" rx=\"33.2948\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"398.3968\" y=\"-188.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">PIP3</text>\n</g>\n<!-- PIP3&#45;&gt;PIP2 -->\n<g id=\"edge3\" class=\"edge\">\n<title>PIP3&#45;&gt;PIP2</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M393.855,-173.7723C390.4685,-163.1924 384.9286,-150.1843 376.3968,-141 367.7755,-131.7194 356.215,-124.4081 345.0243,-118.8684\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"346.3321,-115.6177 335.7837,-114.6274 343.4123,-121.9797 346.3321,-115.6177\"/>\n<text text-anchor=\"middle\" x=\"461.8968\" y=\"-144.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">0.833424626995035</text>\n</g>\n<!-- p44/42 -->\n<g id=\"node6\" class=\"node\">\n<title>p44/42</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"570.3968\" cy=\"-192\" rx=\"42.7926\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"570.3968\" y=\"-188.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">p44/42</text>\n</g>\n<!-- pakts473 -->\n<g id=\"node7\" class=\"node\">\n<title>pakts473</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"570.3968\" cy=\"-105\" rx=\"53.8905\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"570.3968\" y=\"-101.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">pakts473</text>\n</g>\n<!-- p44/42&#45;&gt;pakts473 -->\n<g id=\"edge4\" class=\"edge\">\n<title>p44/42&#45;&gt;pakts473</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M570.3968,-173.9735C570.3968,-162.1918 570.3968,-146.5607 570.3968,-133.1581\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"573.8969,-133.0033 570.3968,-123.0034 566.8969,-133.0034 573.8969,-133.0033\"/>\n<text text-anchor=\"middle\" x=\"640.3968\" y=\"-144.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">2.25734133053002</text>\n</g>\n<!-- PKA -->\n<g id=\"node8\" class=\"node\">\n<title>PKA</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"570.3968\" cy=\"-18\" rx=\"30.5947\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"570.3968\" y=\"-14.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">PKA</text>\n</g>\n<!-- pakts473&#45;&gt;PKA -->\n<g id=\"edge5\" class=\"edge\">\n<title>pakts473&#45;&gt;PKA</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M570.3968,-86.9735C570.3968,-75.1918 570.3968,-59.5607 570.3968,-46.1581\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"573.8969,-46.0033 570.3968,-36.0034 566.8969,-46.0034 573.8969,-46.0033\"/>\n<text text-anchor=\"middle\" x=\"649.3968\" y=\"-57.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">12.587072805304999</text>\n</g>\n<!-- PKC -->\n<g id=\"node9\" class=\"node\">\n<title>PKC</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"661.3968\" cy=\"-192\" rx=\"30.5947\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"661.3968\" y=\"-188.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">PKC</text>\n</g>\n<!-- P38 -->\n<g id=\"node10\" class=\"node\">\n<title>P38</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"738.3968\" cy=\"-192\" rx=\"28.6953\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"738.3968\" y=\"-188.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">P38</text>\n</g>\n<!-- pjnk -->\n<g id=\"node11\" class=\"node\">\n<title>pjnk</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"738.3968\" cy=\"-105\" rx=\"31.3957\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"738.3968\" y=\"-101.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">pjnk</text>\n</g>\n<!-- P38&#45;&gt;pjnk -->\n<g id=\"edge6\" class=\"edge\">\n<title>P38&#45;&gt;pjnk</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M738.3968,-173.9735C738.3968,-162.1918 738.3968,-146.5607 738.3968,-133.1581\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"741.8969,-133.0033 738.3968,-123.0034 734.8969,-133.0034 741.8969,-133.0033\"/>\n<text text-anchor=\"middle\" x=\"817.3968\" y=\"-144.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">0.6993939446648361</text>\n</g>\n</g>\n</svg>\n"
     },
     "metadata": {}
    },
    {
     "output_type": "stream",
     "name": "stdout",
     "text": [
      "Method : PC\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": "<graphviz.dot.Digraph at 0x7ff00da981d0>",
      "image/svg+xml": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<!-- Generated by graphviz version 2.40.1 (20161225.0304)\n -->\n<!-- Title: %3 Pages: 1 -->\n<svg width=\"517pt\" height=\"740pt\"\n viewBox=\"0.00 0.00 517.15 740.00\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 736)\">\n<title>%3</title>\n<polygon fill=\"#ffffff\" stroke=\"transparent\" points=\"-4,4 -4,-736 513.1471,-736 513.1471,4 -4,4\"/>\n<!-- praf -->\n<g id=\"node1\" class=\"node\">\n<title>praf</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"215\" cy=\"-540\" rx=\"29.795\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"215\" y=\"-536.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">praf</text>\n</g>\n<!-- pmek -->\n<g id=\"node2\" class=\"node\">\n<title>pmek</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"211\" cy=\"-453\" rx=\"36.2938\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"211\" y=\"-449.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">pmek</text>\n</g>\n<!-- praf&#45;&gt;pmek -->\n<g id=\"edge4\" class=\"edge\">\n<title>praf&#45;&gt;pmek</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M214.1712,-521.9735C213.6295,-510.1918 212.9108,-494.5607 212.2946,-481.1581\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"215.7834,-480.832 211.8277,-471.0034 208.7908,-481.1536 215.7834,-480.832\"/>\n<text text-anchor=\"middle\" x=\"224.5\" y=\"-492.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- P38 -->\n<g id=\"node10\" class=\"node\">\n<title>P38</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"167\" cy=\"-366\" rx=\"28.6953\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"167\" y=\"-362.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">P38</text>\n</g>\n<!-- pmek&#45;&gt;P38 -->\n<g id=\"edge21\" class=\"edge\">\n<title>pmek&#45;&gt;P38</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M202.0959,-435.3943C195.8527,-423.0496 187.3971,-406.3306 180.3499,-392.3965\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"183.3771,-390.6267 175.7407,-383.2827 177.1305,-393.7859 183.3771,-390.6267\"/>\n<text text-anchor=\"middle\" x=\"202.5\" y=\"-405.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- plcg -->\n<g id=\"node3\" class=\"node\">\n<title>plcg</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"350\" cy=\"-627\" rx=\"30.5947\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"350\" y=\"-623.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">plcg</text>\n</g>\n<!-- plcg&#45;&gt;praf -->\n<g id=\"edge1\" class=\"edge\">\n<title>plcg&#45;&gt;praf</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M320.1055,-622.5319C297.4559,-617.8741 266.6449,-608.6718 245,-591 237.1696,-584.607 230.9263,-575.593 226.207,-566.9177\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"229.255,-565.1857 221.6812,-557.777 222.9819,-568.2917 229.255,-565.1857\"/>\n<text text-anchor=\"middle\" x=\"256.5\" y=\"-579.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- plcg&#45;&gt;pmek -->\n<g id=\"edge5\" class=\"edge\">\n<title>plcg&#45;&gt;pmek</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M335.931,-611.0226C330.5604,-604.83 324.4267,-597.6431 319,-591 282.7243,-546.5931 275.5428,-533.9957 240,-489 237.124,-485.3591 234.0679,-481.5266 231.0599,-477.7749\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"233.6358,-475.3931 224.64,-469.7962 228.1821,-479.7814 233.6358,-475.3931\"/>\n<text text-anchor=\"middle\" x=\"303.5\" y=\"-536.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- PIP3 -->\n<g id=\"node5\" class=\"node\">\n<title>PIP3</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"476\" cy=\"-540\" rx=\"33.2948\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"476\" y=\"-536.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">PIP3</text>\n</g>\n<!-- plcg&#45;&gt;PIP3 -->\n<g id=\"edge9\" class=\"edge\">\n<title>plcg&#45;&gt;PIP3</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M374.9453,-616.4318C389.0121,-609.9712 406.5983,-601.0329 421,-591 432.4662,-583.0121 443.9839,-572.7594 453.4952,-563.5443\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"456.0215,-565.9681 460.6535,-556.4394 451.0904,-560.9998 456.0215,-565.9681\"/>\n<text text-anchor=\"middle\" x=\"449.5\" y=\"-579.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- p44/42 -->\n<g id=\"node6\" class=\"node\">\n<title>p44/42</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"281\" cy=\"-192\" rx=\"42.7926\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"281\" y=\"-188.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">p44/42</text>\n</g>\n<!-- plcg&#45;&gt;p44/42 -->\n<g id=\"edge11\" class=\"edge\">\n<title>plcg&#45;&gt;p44/42</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M354.1724,-609.1538C355.33,-603.3937 356.4262,-596.9575 357,-591 357.6392,-584.364 357.1181,-582.6656 357,-576 354.5045,-435.209 362.3458,-396.2045 323,-261 318.5483,-245.7026 317.0697,-241.737 309,-228 306.8343,-224.3134 304.3364,-220.5803 301.7429,-216.9843\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"304.4626,-214.7783 295.6288,-208.9289 298.8868,-219.0104 304.4626,-214.7783\"/>\n<text text-anchor=\"middle\" x=\"364.5\" y=\"-405.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- pakts473 -->\n<g id=\"node7\" class=\"node\">\n<title>pakts473</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"80\" cy=\"-279\" rx=\"53.8905\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"80\" y=\"-275.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">pakts473</text>\n</g>\n<!-- plcg&#45;&gt;pakts473 -->\n<g id=\"edge14\" class=\"edge\">\n<title>plcg&#45;&gt;pakts473</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M319.2466,-625.9095C233.8401,-622.0521 0,-605.5088 0,-540 0,-540 0,-540 0,-366 0,-338.2847 22.2705,-315.5964 43.3108,-300.3459\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"45.3096,-303.2191 51.5697,-294.6715 41.3456,-297.4497 45.3096,-303.2191\"/>\n<text text-anchor=\"middle\" x=\"11.5\" y=\"-449.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- PKA -->\n<g id=\"node8\" class=\"node\">\n<title>PKA</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"283\" cy=\"-279\" rx=\"30.5947\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"283\" y=\"-275.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">PKA</text>\n</g>\n<!-- plcg&#45;&gt;PKA -->\n<g id=\"edge17\" class=\"edge\">\n<title>plcg&#45;&gt;PKA</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M347.5221,-608.906C340.7588,-560.7269 320.6895,-425.4631 294,-315 293.3463,-312.2942 292.6055,-309.4923 291.8249,-306.701\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"295.0981,-305.427 288.9066,-296.8295 288.3852,-307.4115 295.0981,-305.427\"/>\n<text text-anchor=\"middle\" x=\"336.5\" y=\"-449.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- pjnk -->\n<g id=\"node11\" class=\"node\">\n<title>pjnk</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"200\" cy=\"-105\" rx=\"31.3957\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"200\" y=\"-101.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">pjnk</text>\n</g>\n<!-- plcg&#45;&gt;pjnk -->\n<g id=\"edge23\" class=\"edge\">\n<title>plcg&#45;&gt;pjnk</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M368.328,-612.447C385.9729,-596.6675 410,-569.7235 410,-540 410,-540 410,-540 410,-192 410,-155.5343 300.5581,-126.3782 239.6884,-112.9821\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"240.1554,-109.5025 229.6425,-110.817 238.6806,-116.3454 240.1554,-109.5025\"/>\n<text text-anchor=\"middle\" x=\"421.5\" y=\"-362.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- PIP2 -->\n<g id=\"node4\" class=\"node\">\n<title>PIP2</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"416\" cy=\"-714\" rx=\"33.2948\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"416\" y=\"-710.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">PIP2</text>\n</g>\n<!-- PIP2&#45;&gt;plcg -->\n<g id=\"edge8\" class=\"edge\">\n<title>PIP2&#45;&gt;plcg</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M403.2745,-697.2255C393.5048,-684.3473 379.8644,-666.3667 368.8319,-651.8238\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"371.5187,-649.5745 362.6864,-643.723 365.9419,-653.8053 371.5187,-649.5745\"/>\n<text text-anchor=\"middle\" x=\"397.5\" y=\"-666.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- PIP2&#45;&gt;PIP3 -->\n<g id=\"edge10\" class=\"edge\">\n<title>PIP2&#45;&gt;PIP3</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M424.0909,-696.4075C434.6827,-672.8281 453.2752,-629.4793 465,-591 467.2507,-583.6135 469.2222,-575.491 470.8509,-567.9417\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"474.2839,-568.6233 472.8534,-558.1255 467.4252,-567.2241 474.2839,-568.6233\"/>\n<text text-anchor=\"middle\" x=\"469.5\" y=\"-623.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- p44/42&#45;&gt;pjnk -->\n<g id=\"edge24\" class=\"edge\">\n<title>p44/42&#45;&gt;pjnk</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M265.3824,-175.2255C253.1251,-162.0603 235.9033,-143.5628 222.2114,-128.8567\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"224.3978,-126.0687 215.022,-121.1347 219.2746,-130.8387 224.3978,-126.0687\"/>\n<text text-anchor=\"middle\" x=\"256.5\" y=\"-144.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- pakts473&#45;&gt;praf -->\n<g id=\"edge2\" class=\"edge\">\n<title>pakts473&#45;&gt;praf</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M77.491,-297.0019C74.5409,-324.827 72.5665,-379.03 95,-417 119.6174,-458.6664 161.2204,-496.9162 188.3978,-519.3489\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"186.3639,-522.2058 196.3343,-525.7893 190.7747,-516.7703 186.3639,-522.2058\"/>\n<text text-anchor=\"middle\" x=\"106.5\" y=\"-405.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- pakts473&#45;&gt;pmek -->\n<g id=\"edge6\" class=\"edge\">\n<title>pakts473&#45;&gt;pmek</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M80.5585,-297.3718C82.0767,-319.7462 87.4437,-357.7907 106,-384 122.8386,-407.7832 150.6972,-425.5345 173.4885,-437.0725\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"172.054,-440.2668 182.5783,-441.4873 175.1122,-433.9701 172.054,-440.2668\"/>\n<text text-anchor=\"middle\" x=\"117.5\" y=\"-362.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- pakts473&#45;&gt;p44/42 -->\n<g id=\"edge12\" class=\"edge\">\n<title>pakts473&#45;&gt;p44/42</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M130.4794,-272.5263C159.1379,-267.3785 194.9706,-258.3886 224,-243 236.9017,-236.1607 249.2372,-225.7865 259.1122,-216.1762\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"261.6161,-218.6218 266.1527,-209.0473 256.6355,-213.703 261.6161,-218.6218\"/>\n<text text-anchor=\"middle\" x=\"255.5\" y=\"-231.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- PKA&#45;&gt;praf -->\n<g id=\"edge3\" class=\"edge\">\n<title>PKA&#45;&gt;praf</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M282.3737,-297.1525C280.7631,-331.7256 275.1423,-409.094 256,-471 251.1638,-486.6401 242.1315,-502.4571 233.773,-514.9947\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"230.7002,-513.2837 227.8754,-523.495 236.4515,-517.274 230.7002,-513.2837\"/>\n<text text-anchor=\"middle\" x=\"282.5\" y=\"-405.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- PKA&#45;&gt;pmek -->\n<g id=\"edge7\" class=\"edge\">\n<title>PKA&#45;&gt;pmek</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M272.7278,-296.1762C264.7854,-309.8957 253.8556,-329.7755 246,-348 235.0186,-373.476 225.2915,-403.6128 218.8966,-425.0505\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"215.4881,-424.2364 216.0341,-434.8171 222.2055,-426.2053 215.4881,-424.2364\"/>\n<text text-anchor=\"middle\" x=\"257.5\" y=\"-362.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- PKA&#45;&gt;p44/42 -->\n<g id=\"edge13\" class=\"edge\">\n<title>PKA&#45;&gt;p44/42</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M282.5856,-260.9735C282.3148,-249.1918 281.9554,-233.5607 281.6473,-220.1581\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"285.1429,-219.9202 281.4139,-210.0034 278.1447,-220.0812 285.1429,-219.9202\"/>\n<text text-anchor=\"middle\" x=\"293.5\" y=\"-231.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- PKC -->\n<g id=\"node9\" class=\"node\">\n<title>PKC</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"106\" cy=\"-18\" rx=\"30.5947\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"106\" y=\"-14.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">PKC</text>\n</g>\n<!-- P38&#45;&gt;pakts473 -->\n<g id=\"edge15\" class=\"edge\">\n<title>P38&#45;&gt;pakts473</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M149.3541,-351.8101C141.6567,-345.3855 132.6601,-337.551 125,-330 116.843,-321.9592 108.4068,-312.6898 101.0741,-304.2772\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"103.5991,-301.8453 94.4271,-296.5421 98.2901,-306.4076 103.5991,-301.8453\"/>\n<text text-anchor=\"middle\" x=\"136.5\" y=\"-318.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- P38&#45;&gt;PKA -->\n<g id=\"edge18\" class=\"edge\">\n<title>P38&#45;&gt;PKA</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M181.7543,-350.2692C192.164,-339.6362 206.7418,-325.648 221,-315 230.3152,-308.0434 241.0867,-301.3707 251.0117,-295.7007\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"252.7873,-298.7182 259.8225,-290.7962 249.3827,-292.6019 252.7873,-298.7182\"/>\n<text text-anchor=\"middle\" x=\"232.5\" y=\"-318.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- P38&#45;&gt;PKC -->\n<g id=\"edge19\" class=\"edge\">\n<title>P38&#45;&gt;PKC</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M165.3982,-347.6886C162.9338,-326.0365 156.9394,-289.3614 143,-261 130.0479,-234.6473 110.9158,-237.6387 101,-210 81.084,-154.4875 91.0748,-84.0319 99.1538,-45.7804\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"102.6001,-46.4061 101.3554,-35.8847 95.7672,-44.8859 102.6001,-46.4061\"/>\n<text text-anchor=\"middle\" x=\"112.5\" y=\"-188.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- pjnk&#45;&gt;pakts473 -->\n<g id=\"edge16\" class=\"edge\">\n<title>pjnk&#45;&gt;pakts473</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M188.3332,-121.9169C167.3293,-152.3725 123.0222,-216.6178 98.068,-252.8014\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"94.9627,-251.1392 92.1666,-261.3584 100.7252,-255.1133 94.9627,-251.1392\"/>\n<text text-anchor=\"middle\" x=\"162.5\" y=\"-188.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- pjnk&#45;&gt;PKC -->\n<g id=\"edge20\" class=\"edge\">\n<title>pjnk&#45;&gt;PKC</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M183.1947,-89.4461C168.4909,-75.8374 146.9498,-55.9004 130.3565,-40.5427\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"132.3763,-37.6431 122.6598,-33.4192 127.6215,-42.7804 132.3763,-37.6431\"/>\n<text text-anchor=\"middle\" x=\"169.5\" y=\"-57.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- pjnk&#45;&gt;P38 -->\n<g id=\"edge22\" class=\"edge\">\n<title>pjnk&#45;&gt;P38</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M198.11,-123.119C194.055,-161.3959 183.9909,-253.2781 173,-330 172.6305,-332.5794 172.2248,-335.2592 171.8042,-337.9404\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"168.3059,-337.6471 170.1525,-348.0798 175.2149,-338.7727 168.3059,-337.6471\"/>\n<text text-anchor=\"middle\" x=\"197.5\" y=\"-231.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n</g>\n</svg>\n"
     },
     "metadata": {}
    },
    {
     "output_type": "stream",
     "name": "stdout",
     "text": [
      "Method : GES\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": "<graphviz.dot.Digraph at 0x7fef9822b0b8>",
      "image/svg+xml": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<!-- Generated by graphviz version 2.40.1 (20161225.0304)\n -->\n<!-- Title: %3 Pages: 1 -->\n<svg width=\"696pt\" height=\"740pt\"\n viewBox=\"0.00 0.00 696.00 740.00\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 736)\">\n<title>%3</title>\n<polygon fill=\"#ffffff\" stroke=\"transparent\" points=\"-4,4 -4,-736 692,-736 692,4 -4,4\"/>\n<!-- praf -->\n<g id=\"node1\" class=\"node\">\n<title>praf</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"252\" cy=\"-453\" rx=\"29.795\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"252\" y=\"-449.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">praf</text>\n</g>\n<!-- plcg -->\n<g id=\"node3\" class=\"node\">\n<title>plcg</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"362\" cy=\"-366\" rx=\"30.5947\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"362\" y=\"-362.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">plcg</text>\n</g>\n<!-- praf&#45;&gt;plcg -->\n<g id=\"edge6\" class=\"edge\">\n<title>praf&#45;&gt;plcg</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M262.3048,-435.7976C269.3679,-425.0746 279.515,-411.5489 291,-402 301.5657,-393.2155 314.6334,-385.8244 326.6663,-380.0693\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"328.375,-383.1372 336.0269,-375.8093 325.4754,-376.7659 328.375,-383.1372\"/>\n<text text-anchor=\"middle\" x=\"302.5\" y=\"-405.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- p44/42 -->\n<g id=\"node6\" class=\"node\">\n<title>p44/42</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"310\" cy=\"-18\" rx=\"42.7926\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"310\" y=\"-14.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">p44/42</text>\n</g>\n<!-- praf&#45;&gt;p44/42 -->\n<g id=\"edge15\" class=\"edge\">\n<title>praf&#45;&gt;p44/42</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M240.6843,-435.9882C234.079,-426.0676 225.579,-413.3176 218,-402 168.3757,-327.897 106,-324.6842 106,-235.5 106,-235.5 106,-235.5 106,-105 106,-71.3325 201.2017,-43.0633 261.5336,-28.5286\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"262.7007,-31.8493 271.6292,-26.1455 261.0925,-25.0365 262.7007,-31.8493\"/>\n<text text-anchor=\"middle\" x=\"118.5\" y=\"-231.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- pakts473 -->\n<g id=\"node7\" class=\"node\">\n<title>pakts473</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"263\" cy=\"-192\" rx=\"53.8905\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"263\" y=\"-188.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">pakts473</text>\n</g>\n<!-- praf&#45;&gt;pakts473 -->\n<g id=\"edge21\" class=\"edge\">\n<title>praf&#45;&gt;pakts473</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M251.9247,-434.6856C251.8933,-408.2454 252.1235,-357.8488 254,-315 255.4199,-282.578 258.3134,-245.4308 260.4378,-220.5192\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"263.9452,-220.5838 261.3231,-210.3186 256.9714,-219.9785 263.9452,-220.5838\"/>\n<text text-anchor=\"middle\" x=\"265.5\" y=\"-318.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- pmek -->\n<g id=\"node2\" class=\"node\">\n<title>pmek</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"227\" cy=\"-540\" rx=\"36.2938\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"227\" y=\"-536.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">pmek</text>\n</g>\n<!-- pmek&#45;&gt;praf -->\n<g id=\"edge1\" class=\"edge\">\n<title>pmek&#45;&gt;praf</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M232.18,-521.9735C235.5991,-510.0751 240.1463,-494.2508 244.0228,-480.7606\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"247.4286,-481.5811 246.8266,-471.0034 240.7009,-479.6478 247.4286,-481.5811\"/>\n<text text-anchor=\"middle\" x=\"252.5\" y=\"-492.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- pmek&#45;&gt;plcg -->\n<g id=\"edge7\" class=\"edge\">\n<title>pmek&#45;&gt;plcg</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M246.6693,-524.4112C253.7437,-518.3816 261.5606,-511.2033 268,-504 300.0771,-468.1178 330.0856,-420.7322 347.2161,-391.8576\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"350.2707,-393.5676 352.3117,-383.1712 344.2329,-390.0257 350.2707,-393.5676\"/>\n<text text-anchor=\"middle\" x=\"331.5\" y=\"-449.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- PIP3 -->\n<g id=\"node5\" class=\"node\">\n<title>PIP3</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"205\" cy=\"-279\" rx=\"33.2948\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"205\" y=\"-275.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">PIP3</text>\n</g>\n<!-- pmek&#45;&gt;PIP3 -->\n<g id=\"edge11\" class=\"edge\">\n<title>pmek&#45;&gt;PIP3</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M222.5248,-521.9684C219.2874,-508.1209 215.123,-488.473 213,-471 205.9679,-413.1251 204.8086,-344.7975 204.781,-307.2553\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"208.2812,-307.0843 204.8013,-297.0773 201.2812,-307.0702 208.2812,-307.0843\"/>\n<text text-anchor=\"middle\" x=\"220.5\" y=\"-405.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- pmek&#45;&gt;p44/42 -->\n<g id=\"edge16\" class=\"edge\">\n<title>pmek&#45;&gt;p44/42</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M191.1861,-536.4649C165.2195,-532.3256 130.5036,-523.3647 106,-504 61.1285,-468.5389 46,-382.7926 46,-322.5 46,-322.5 46,-322.5 46,-105 46,-60.7207 181.6585,-35.218 258.4849,-24.3256\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"259.0332,-27.7832 268.4596,-22.9464 258.0744,-20.8491 259.0332,-27.7832\"/>\n<text text-anchor=\"middle\" x=\"57.5\" y=\"-275.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- pmek&#45;&gt;pakts473 -->\n<g id=\"edge22\" class=\"edge\">\n<title>pmek&#45;&gt;pakts473</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M193.6222,-532.7377C166.1861,-526.0633 130.3629,-515.4869 121,-504 76.993,-450.0098 87.8219,-415.2392 106,-348 122.114,-288.3956 129.48,-268.5984 176,-228 186.1085,-219.1782 198.6783,-212.3126 211.0921,-207.0557\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"212.4909,-210.2664 220.5111,-203.3435 209.9242,-203.754 212.4909,-210.2664\"/>\n<text text-anchor=\"middle\" x=\"117.5\" y=\"-362.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- pjnk -->\n<g id=\"node11\" class=\"node\">\n<title>pjnk</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"425\" cy=\"-105\" rx=\"31.3957\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"425\" y=\"-101.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">pjnk</text>\n</g>\n<!-- pmek&#45;&gt;pjnk -->\n<g id=\"edge32\" class=\"edge\">\n<title>pmek&#45;&gt;pjnk</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M253.0115,-527.0982C309.2897,-498.4953 438.6967,-428.7567 456,-384 494.9444,-283.266 493.5858,-242.2487 456,-141 454.2957,-136.4089 451.7144,-132.011 448.7545,-127.9635\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"451.388,-125.6561 442.3071,-120.1981 446.0023,-130.1277 451.388,-125.6561\"/>\n<text text-anchor=\"middle\" x=\"489.5\" y=\"-318.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- plcg&#45;&gt;PIP3 -->\n<g id=\"edge12\" class=\"edge\">\n<title>plcg&#45;&gt;PIP3</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M340.717,-352.9476C329.7176,-346.1621 316.0985,-337.6985 304,-330 293.7037,-323.4483 291.6502,-320.9592 281,-315 267.9793,-307.7144 253.2429,-300.5087 240.2357,-294.48\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"241.6692,-291.287 231.1192,-290.314 238.7597,-297.6538 241.6692,-291.287\"/>\n<text text-anchor=\"middle\" x=\"315.5\" y=\"-318.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- plcg&#45;&gt;p44/42 -->\n<g id=\"edge17\" class=\"edge\">\n<title>plcg&#45;&gt;p44/42</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M359.8422,-347.7776C357.3385,-326.8264 353.036,-291.4085 349,-261 341.9127,-207.6024 340.5212,-194.1876 332,-141 326.7753,-108.3882 319.9837,-71.0615 315.337,-46.1629\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"318.7712,-45.4863 313.4877,-36.303 311.8912,-46.7768 318.7712,-45.4863\"/>\n<text text-anchor=\"middle\" x=\"353.5\" y=\"-188.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- plcg&#45;&gt;pakts473 -->\n<g id=\"edge23\" class=\"edge\">\n<title>plcg&#45;&gt;pakts473</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M352.1456,-348.6801C334.8157,-318.2215 298.7762,-254.8794 278.2237,-218.7569\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"281.0967,-216.7287 273.1093,-209.7679 275.0125,-220.1904 281.0967,-216.7287\"/>\n<text text-anchor=\"middle\" x=\"333.5\" y=\"-275.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- plcg&#45;&gt;pjnk -->\n<g id=\"edge33\" class=\"edge\">\n<title>plcg&#45;&gt;pjnk</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M371.7534,-348.8263C374.7474,-342.9939 377.8229,-336.3451 380,-330 392.4318,-293.767 411.5818,-184.989 420.3397,-133.1142\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"423.8412,-133.3964 422.0446,-122.955 416.9377,-132.2377 423.8412,-133.3964\"/>\n<text text-anchor=\"middle\" x=\"413.5\" y=\"-231.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- PIP2 -->\n<g id=\"node4\" class=\"node\">\n<title>PIP2</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"240\" cy=\"-714\" rx=\"33.2948\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"240\" y=\"-710.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">PIP2</text>\n</g>\n<!-- PIP2&#45;&gt;plcg -->\n<g id=\"edge8\" class=\"edge\">\n<title>PIP2&#45;&gt;plcg</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M272.4212,-709.3894C293.0682,-704.806 318.8717,-695.7555 335,-678 407.5926,-598.0833 383.812,-454.4183 369.4913,-393.9888\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"372.8295,-392.9071 367.037,-384.036 366.0331,-394.5831 372.8295,-392.9071\"/>\n<text text-anchor=\"middle\" x=\"395.5\" y=\"-536.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- PIP2&#45;&gt;PIP3 -->\n<g id=\"edge13\" class=\"edge\">\n<title>PIP2&#45;&gt;PIP3</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M212.9801,-703.4637C184.2786,-690.2905 143,-664.7779 143,-627 143,-627 143,-627 143,-366 143,-340.105 161.4412,-316.578 178.2087,-300.5383\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"180.6732,-303.0281 185.7227,-293.7139 175.9669,-297.8463 180.6732,-303.0281\"/>\n<text text-anchor=\"middle\" x=\"154.5\" y=\"-492.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- PKC -->\n<g id=\"node9\" class=\"node\">\n<title>PKC</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"240\" cy=\"-627\" rx=\"30.5947\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"240\" y=\"-623.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">PKC</text>\n</g>\n<!-- PIP2&#45;&gt;PKC -->\n<g id=\"edge30\" class=\"edge\">\n<title>PIP2&#45;&gt;PKC</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M240,-695.9735C240,-684.1918 240,-668.5607 240,-655.1581\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"243.5001,-655.0033 240,-645.0034 236.5001,-655.0034 243.5001,-655.0033\"/>\n<text text-anchor=\"middle\" x=\"251.5\" y=\"-666.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- PIP3&#45;&gt;pakts473 -->\n<g id=\"edge24\" class=\"edge\">\n<title>PIP3&#45;&gt;pakts473</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M211.7086,-261.2621C215.9447,-251.0995 221.9447,-238.3495 229,-228 231.6315,-224.1398 234.6779,-220.2962 237.8445,-216.6362\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"240.6818,-218.7203 244.8542,-208.9816 235.5193,-213.9928 240.6818,-218.7203\"/>\n<text text-anchor=\"middle\" x=\"240.5\" y=\"-231.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- p44/42&#45;&gt;pakts473 -->\n<g id=\"edge25\" class=\"edge\">\n<title>p44/42&#45;&gt;pakts473</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M291.5396,-34.3767C278.5468,-47.2154 262.2329,-66.3221 255,-87 246.2334,-112.0627 249.9886,-142.4829 254.8794,-164.1151\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"251.5182,-165.1027 257.3216,-173.9667 258.3125,-163.4183 251.5182,-165.1027\"/>\n<text text-anchor=\"middle\" x=\"266.5\" y=\"-101.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- p44/42&#45;&gt;pjnk -->\n<g id=\"edge34\" class=\"edge\">\n<title>p44/42&#45;&gt;pjnk</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M348.5328,-26.2813C366.254,-31.7058 386.5073,-40.3946 401,-54 407.7687,-60.3544 412.8168,-69.0036 416.4898,-77.3739\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"413.312,-78.8596 420.1908,-86.9176 419.8384,-76.3286 413.312,-78.8596\"/>\n<text text-anchor=\"middle\" x=\"423.5\" y=\"-57.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- pakts473&#45;&gt;PIP3 -->\n<g id=\"edge14\" class=\"edge\">\n<title>pakts473&#45;&gt;PIP3</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M218.036,-202.0541C204.4499,-207.4209 191.0216,-215.594 183,-228 177.7928,-236.0533 179.9519,-245.5465 184.5396,-254.1453\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"181.6607,-256.1403 189.9927,-262.6847 187.5604,-252.3728 181.6607,-256.1403\"/>\n<text text-anchor=\"middle\" x=\"194.5\" y=\"-231.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- pakts473&#45;&gt;p44/42 -->\n<g id=\"edge18\" class=\"edge\">\n<title>pakts473&#45;&gt;p44/42</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M267.8528,-174.0343C276.05,-143.6874 292.6952,-82.0644 302.4354,-46.0052\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"305.8743,-46.6954 305.1032,-36.1286 299.1165,-44.8699 305.8743,-46.6954\"/>\n<text text-anchor=\"middle\" x=\"303.5\" y=\"-101.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- pakts473&#45;&gt;pjnk -->\n<g id=\"edge35\" class=\"edge\">\n<title>pakts473&#45;&gt;pjnk</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M274.8613,-174.1379C282.9995,-163.1517 294.7057,-149.5806 308,-141 331.1759,-126.0415 360.9264,-116.9972 384.6274,-111.7151\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"385.6372,-115.0798 394.7111,-109.6103 384.2069,-108.2275 385.6372,-115.0798\"/>\n<text text-anchor=\"middle\" x=\"319.5\" y=\"-144.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- PKA -->\n<g id=\"node8\" class=\"node\">\n<title>PKA</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"483\" cy=\"-627\" rx=\"30.5947\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"483\" y=\"-623.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">PKA</text>\n</g>\n<!-- PKA&#45;&gt;praf -->\n<g id=\"edge2\" class=\"edge\">\n<title>PKA&#45;&gt;praf</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M459.3015,-615.4811C436.4631,-604.6001 400.7881,-588.1772 369,-576 344.587,-566.648 333.365,-574.3927 313,-558 299.4846,-547.1209 278.1325,-506.8265 264.6078,-479.4387\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"267.7077,-477.8104 260.176,-470.359 261.4171,-480.8809 267.7077,-477.8104\"/>\n<text text-anchor=\"middle\" x=\"324.5\" y=\"-536.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- PKA&#45;&gt;pmek -->\n<g id=\"edge3\" class=\"edge\">\n<title>PKA&#45;&gt;pmek</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M454.2966,-620.7627C426.3208,-614.3792 382.7474,-603.625 346,-591 317.4144,-581.1791 286.0251,-567.6036 262.6649,-556.9278\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"264.0415,-553.7085 253.495,-552.6977 261.1093,-560.0647 264.0415,-553.7085\"/>\n<text text-anchor=\"middle\" x=\"357.5\" y=\"-579.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- PKA&#45;&gt;plcg -->\n<g id=\"edge9\" class=\"edge\">\n<title>PKA&#45;&gt;plcg</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M482.6484,-608.755C481.5132,-581.5344 476.9468,-529.1905 459,-489 441.3664,-449.511 408.2108,-411.6198 385.6215,-388.579\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"387.9472,-385.9548 378.4036,-381.3537 382.9949,-390.902 387.9472,-385.9548\"/>\n<text text-anchor=\"middle\" x=\"475.5\" y=\"-492.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- PKA&#45;&gt;p44/42 -->\n<g id=\"edge19\" class=\"edge\">\n<title>PKA&#45;&gt;p44/42</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M503.7439,-613.3978C511.8229,-607.3038 520.6467,-599.5592 527,-591 603.9637,-487.3139 638,-451.6287 638,-322.5 638,-322.5 638,-322.5 640,-105 640,-48.3913 456.1368,-27.8187 362.8933,-21.0254\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"363.0237,-17.526 352.8034,-20.3183 362.5343,-24.5089 363.0237,-17.526\"/>\n<text text-anchor=\"middle\" x=\"649.5\" y=\"-318.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- PKA&#45;&gt;pakts473 -->\n<g id=\"edge26\" class=\"edge\">\n<title>PKA&#45;&gt;pakts473</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M489.2002,-609.0183C505.069,-559.9912 543.2332,-420.5974 504,-315 486.2202,-267.145 473.2436,-253.47 429,-228 391.3784,-206.3421 375.3779,-219.4106 333,-210 327.1929,-208.7104 321.136,-207.2812 315.1211,-205.8083\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"315.6394,-202.3304 305.0895,-203.3052 313.9447,-209.1221 315.6394,-202.3304\"/>\n<text text-anchor=\"middle\" x=\"532.5\" y=\"-405.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- PKA&#45;&gt;pjnk -->\n<g id=\"edge36\" class=\"edge\">\n<title>PKA&#45;&gt;pjnk</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M496.8198,-610.8971C501.4611,-604.9271 506.3742,-597.9202 510,-591 517.1751,-577.3058 516.8609,-572.8956 521,-558 544.4123,-473.7452 564,-453.4472 564,-366 564,-366 564,-366 564,-192 564,-144.9221 506.0006,-122.3631 464.9322,-112.2905\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"465.6906,-108.8736 455.1609,-110.0469 464.124,-115.6961 465.6906,-108.8736\"/>\n<text text-anchor=\"middle\" x=\"575.5\" y=\"-362.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- PKC&#45;&gt;pmek -->\n<g id=\"edge4\" class=\"edge\">\n<title>PKC&#45;&gt;pmek</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M237.3064,-608.9735C235.5459,-597.1918 233.2102,-581.5607 231.2075,-568.1581\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"234.6297,-567.3763 229.6902,-558.0034 227.7065,-568.4108 234.6297,-567.3763\"/>\n<text text-anchor=\"middle\" x=\"246.5\" y=\"-579.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- PKC&#45;&gt;pjnk -->\n<g id=\"edge37\" class=\"edge\">\n<title>PKC&#45;&gt;pjnk</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M267.098,-618.5592C277.3708,-615.4414 289.1942,-611.9511 300,-609 332.2356,-600.1962 345.6541,-610.2053 373,-591 387.4251,-580.8692 389.0188,-574.5814 395,-558 418.8823,-491.7926 424.3283,-313.2872 428,-243 430.3649,-197.7284 429.884,-186.2942 428,-141 427.8988,-138.5679 427.7594,-136.0458 427.5956,-133.5168\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"431.0668,-133.0026 426.8209,-123.2957 424.0868,-133.5317 431.0668,-133.0026\"/>\n<text text-anchor=\"middle\" x=\"433.5\" y=\"-362.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- P38 -->\n<g id=\"node10\" class=\"node\">\n<title>P38</title>\n<ellipse fill=\"none\" stroke=\"#000000\" cx=\"409\" cy=\"-714\" rx=\"28.6953\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"409\" y=\"-710.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">P38</text>\n</g>\n<!-- P38&#45;&gt;pmek -->\n<g id=\"edge5\" class=\"edge\">\n<title>P38&#45;&gt;pmek</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M394.2234,-698.1427C384.6194,-687.9561 371.7445,-674.523 360,-663 323.425,-627.1151 279.5372,-587.089 252.4572,-562.7261\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"254.7317,-560.0645 244.9524,-555.9883 250.0553,-565.2733 254.7317,-560.0645\"/>\n<text text-anchor=\"middle\" x=\"351.5\" y=\"-623.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- P38&#45;&gt;plcg -->\n<g id=\"edge10\" class=\"edge\">\n<title>P38&#45;&gt;plcg</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M436.5332,-708.8977C497.5444,-696.0441 636.7662,-657.3874 611,-576 578.597,-473.6489 457.3184,-407.6136 396.8001,-380.3188\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"398.1936,-377.1081 387.6318,-376.2711 395.3664,-383.5118 398.1936,-377.1081\"/>\n<text text-anchor=\"middle\" x=\"614.5\" y=\"-536.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- P38&#45;&gt;pakts473 -->\n<g id=\"edge27\" class=\"edge\">\n<title>P38&#45;&gt;pakts473</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M380.2015,-712.6652C344.5521,-709.9966 282.823,-701.9943 236,-678 94.6064,-605.5432 0,-568.3777 0,-409.5 0,-409.5 0,-409.5 0,-279 0,-236.6555 124.4411,-211.4008 202.1256,-199.7606\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"202.9023,-203.1844 212.291,-198.2748 201.8899,-196.258 202.9023,-203.1844\"/>\n<text text-anchor=\"middle\" x=\"17.5\" y=\"-449.3\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- P38&#45;&gt;PKA -->\n<g id=\"edge29\" class=\"edge\">\n<title>P38&#45;&gt;PKA</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M422.5727,-698.0429C433.7681,-684.8808 449.8245,-666.0036 462.5727,-651.0159\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"465.4497,-653.0355 469.2627,-643.1506 460.1176,-648.5002 465.4497,-653.0355\"/>\n<text text-anchor=\"middle\" x=\"461.5\" y=\"-666.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- P38&#45;&gt;PKC -->\n<g id=\"edge31\" class=\"edge\">\n<title>P38&#45;&gt;PKC</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M386.2407,-702.7685C372.0446,-695.7261 353.415,-686.4179 337,-678 315.1309,-666.7851 290.6342,-653.9028 271.7299,-643.8913\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"273.1411,-640.678 262.6667,-639.0847 269.8613,-646.8621 273.1411,-640.678\"/>\n<text text-anchor=\"middle\" x=\"348.5\" y=\"-666.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- P38&#45;&gt;pjnk -->\n<g id=\"edge38\" class=\"edge\">\n<title>P38&#45;&gt;pjnk</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M437.2737,-710.5639C469.2706,-705.9809 522.4665,-696.2384 565,-678 589.471,-667.5068 599.9391,-666.957 615,-645 695.1822,-528.1041 658.9843,-471.625 665,-330 669.1246,-232.8964 634.3197,-197.1649 555,-141 528.7314,-122.3996 493.1977,-113.3949 465.9191,-109.0439\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"466.3034,-105.5631 455.905,-107.5938 465.3002,-112.4908 466.3034,-105.5631\"/>\n<text text-anchor=\"middle\" x=\"676.5\" y=\"-405.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- pjnk&#45;&gt;p44/42 -->\n<g id=\"edge20\" class=\"edge\">\n<title>pjnk&#45;&gt;p44/42</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M406.0101,-90.6337C387.8434,-76.8902 360.185,-55.966 339.2128,-40.1001\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"341.054,-37.1043 330.9674,-33.8623 336.8307,-42.6868 341.054,-37.1043\"/>\n<text text-anchor=\"middle\" x=\"385.5\" y=\"-57.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n<!-- pjnk&#45;&gt;pakts473 -->\n<g id=\"edge28\" class=\"edge\">\n<title>pjnk&#45;&gt;pakts473</title>\n<path fill=\"none\" stroke=\"#000000\" d=\"M402.9857,-117.898C384.8726,-128.4077 358.4572,-143.5003 335,-156 324.6022,-161.5407 313.2444,-167.3363 302.6865,-172.618\"/>\n<polygon fill=\"#000000\" stroke=\"#000000\" points=\"301.0538,-169.521 293.6586,-177.1079 304.1709,-175.7886 301.0538,-169.521\"/>\n<text text-anchor=\"middle\" x=\"370.5\" y=\"-144.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1.0</text>\n</g>\n</g>\n</svg>\n"
     },
     "metadata": {}
    }
   ],
   "source": [
    "from cdt.causality.graph import LiNGAM, PC, GES\n",
    "\n",
    "graphs = {}\n",
    "graphs_nx = {}\n",
    "labels = [f'{col}' for i, col in enumerate(data_sachs.columns)]\n",
    "functions = {\n",
    "    'LiNGAM' : LiNGAM,\n",
    "    'PC' : PC,\n",
    "    'GES' : GES,\n",
    "}\n",
    "\n",
    "for method, lib in functions.items():\n",
    "    obj = lib()\n",
    "    output = obj.predict(data_sachs)\n",
    "    graphs_nx[method] = output\n",
    "    adj_matrix = nx.to_numpy_matrix(output)\n",
    "    adj_matrix = np.asarray(adj_matrix)\n",
    "    graph_dot = make_graph(adj_matrix, labels)\n",
    "    graphs[method] = graph_dot\n",
    "\n",
    "# Visualize graphs\n",
    "for method, graph in graphs.items():\n",
    "    print(\"Method : %s\"%(method))\n",
    "    display(graph)"
   ]
  },
  {
   "source": [
    "As you can see, no two methods agree on the graphs. Next we study the causal effects of these different graphs"
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "source": [
    "## Estimate effects using Linear Regression\n",
    "\n",
    "Now let us see whether these differences in the graphs also lead to signficant differences in the causal estimate of effect of *PIP2* on *PKC*."
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "output_type": "stream",
     "name": "stdout",
     "text": [
      "\n",
      "*****************************************************************************\n",
      "\n",
      "Causal Discovery Method : LiNGAM\n",
      "Estimand type: nonparametric-ate\n",
      "\n",
      "### Estimand : 1\n",
      "Estimand name: backdoor\n",
      "Estimand expression:\n",
      "   d                     \n",
      "───────(Expectation(PKC))\n",
      "d[PIP₂]                  \n",
      "Estimand assumption 1, Unconfoundedness: If U→{PIP2} and U→PKC then P(PKC|PIP2,,U) = P(PKC|PIP2,)\n",
      "\n",
      "### Estimand : 2\n",
      "Estimand name: iv\n",
      "Estimand expression:\n",
      "Expectation(Derivative(PKC, [PIP3, plcg])*Derivative([PIP2], [PIP3, plcg])**(-\n",
      "1))\n",
      "Estimand assumption 1, As-if-random: If U→→PKC then ¬(U →→{PIP3,plcg})\n",
      "Estimand assumption 2, Exclusion: If we remove {PIP3,plcg}→{PIP2}, then ¬({PIP3,plcg}→PKC)\n",
      "\n",
      "### Estimand : 3\n",
      "Estimand name: frontdoor\n",
      "No such variable found!\n",
      "\n",
      "Causal Estimate is 0.10456597412424884\n",
      "\n",
      "*****************************************************************************\n",
      "\n",
      "Causal Discovery Method : PC\n",
      "Estimand type: nonparametric-ate\n",
      "\n",
      "### Estimand : 1\n",
      "Estimand name: backdoor\n",
      "Estimand expression:\n",
      "   d                     \n",
      "───────(Expectation(PKC))\n",
      "d[PIP₂]                  \n",
      "Estimand assumption 1, Unconfoundedness: If U→{PIP2} and U→PKC then P(PKC|PIP2,,U) = P(PKC|PIP2,)\n",
      "\n",
      "### Estimand : 2\n",
      "Estimand name: iv\n",
      "No such variable found!\n",
      "\n",
      "### Estimand : 3\n",
      "Estimand name: frontdoor\n",
      "Estimand expression:\n",
      "Expectation(Derivative(PKC, [plcg])*Derivative([plcg], [PIP2]))\n",
      "Estimand assumption 1, Full-mediation: plcg intercepts (blocks) all directed paths from PIP2 to P,K,C.\n",
      "Estimand assumption 2, First-stage-unconfoundedness: If U→{PIP2} and U→{plcg} then P(plcg|PIP2,U) = P(plcg|PIP2)\n",
      "Estimand assumption 3, Second-stage-unconfoundedness: If U→{plcg} and U→PKC then P(PKC|plcg, PIP2, U) = P(PKC|plcg, PIP2)\n",
      "\n",
      "Causal Estimate is 0.10456597412424884\n",
      "\n",
      "*****************************************************************************\n",
      "\n",
      "Causal Discovery Method : GES\n",
      "Estimand type: nonparametric-ate\n",
      "\n",
      "### Estimand : 1\n",
      "Estimand name: backdoor\n",
      "Estimand expression:\n",
      "   d                             \n",
      "───────(Expectation(PKC|PKA,P38))\n",
      "d[PIP₂]                          \n",
      "Estimand assumption 1, Unconfoundedness: If U→{PIP2} and U→PKC then P(PKC|PIP2,PKA,P38,U) = P(PKC|PIP2,PKA,P38)\n",
      "\n",
      "### Estimand : 2\n",
      "Estimand name: iv\n",
      "No such variable found!\n",
      "\n",
      "### Estimand : 3\n",
      "Estimand name: frontdoor\n",
      "No such variable found!\n",
      "\n",
      "Causal Estimate is -0.013018300750143652\n"
     ]
    }
   ],
   "source": [
    "for method, graph in graphs.items():\n",
    "        print('\\n*****************************************************************************\\n')\n",
    "        print(\"Causal Discovery Method : %s\"%(method))\n",
    "\n",
    "        # Obtain valid dot format\n",
    "        graph_dot = str_to_dot(graph.source)\n",
    "\n",
    "        # Define Causal Model\n",
    "        model=CausalModel(\n",
    "                data = data_sachs,\n",
    "                treatment='PIP2',\n",
    "                outcome='PKC',\n",
    "                graph=graph_dot)\n",
    "\n",
    "        # Identification\n",
    "        identified_estimand = model.identify_effect(proceed_when_unidentifiable=True)\n",
    "        print(identified_estimand)\n",
    "\n",
    "        # Estimation\n",
    "        estimate = model.estimate_effect(identified_estimand,\n",
    "                                        method_name=\"backdoor.linear_regression\",\n",
    "                                        control_value=0,\n",
    "                                        treatment_value=1,\n",
    "                                        confidence_intervals=True,\n",
    "                                        test_significance=True)\n",
    "        print(\"Causal Estimate is \" + str(estimate.value))"
   ]
  },
  {
   "source": [
    "From the causal estimates obtained, it can be seen that the three estimates differ in different aspects. The graph obtained using LiNGAM contains a backdoor path and instrumental variables. On the other hand, the graph obtained using PC contains a backdoor path and a frontdoor path. However, despite these differences, both obtain the same mean causal estimate.\n",
    "\n",
    "The graph obtained using GES contains only a backdoor path with different backdoor variables and obtains a different causal estimate than the first two cases. "
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "source": [
    "## Graph Validation\n",
    "\n",
    "We compare the graphs obtained with the true causal graph using the causal discovery methods using 2 graph distance metrics - Structural Hamming Distance (SHD) and Structural Intervention Distance (SID). SHD between two graphs is, in simple terms, the number of edge insertions, deletions or flips in order to transform one graph to another graph. SID, on the other hand, is based on a graphical criterion only and quantifies the closeness between two DAGs in terms of their corresponding causal inference statements."
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "output_type": "stream",
     "name": "stdout",
     "text": [
      "***********************************************************\n",
      "Method: LiNGAM\n",
      "SHD_CPDAG = 17.000000\n",
      "SHD = 18.000000\n",
      "SID_CPDAG = [80.000000, 80.000000]\n",
      "SID = 80.000000\n",
      "***********************************************************\n",
      "Method: PC\n",
      "SHD_CPDAG = 29.000000\n",
      "SHD = 27.000000\n",
      "SID_CPDAG = [82.000000, 82.000000]\n",
      "SID = 82.000000\n",
      "***********************************************************\n",
      "Method: GES\n",
      "SHD_CPDAG = 34.000000\n",
      "SHD = 31.000000\n",
      "SID_CPDAG = [82.000000, 88.000000]\n",
      "SID = 91.000000\n"
     ]
    }
   ],
   "source": [
    "from cdt.metrics import SHD, SHD_CPDAG, SID, SID_CPDAG\n",
    "from numpy.random import randint\n",
    "\n",
    "for method, graph in graphs_nx.items():\n",
    "    print(\"***********************************************************\")\n",
    "    print(\"Method: %s\"%(method))\n",
    "    tar, pred = graph_sachs, graph\n",
    "    print(\"SHD_CPDAG = %f\"%(SHD_CPDAG(tar, pred)))\n",
    "    print(\"SHD = %f\"%(SHD(tar, pred, double_for_anticausal=False)))\n",
    "    print(\"SID_CPDAG = [%f, %f]\"%(SID_CPDAG(tar, pred)))\n",
    "    print(\"SID = %f\"%(SID(tar, pred)))"
   ]
  },
  {
   "source": [
    "The graph similarity metrics show that the scores are the lowest for the LiNGAM method of graph extraction. Hence, of the three methods used, LiNGAM provides the graph that is most similar to the original graph."
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "source": [
    "## Graph Refutation\n",
    "\n",
    "Here, we use the same SHD and SID metric to find out how different the discovered graph are from each other."
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "output_type": "stream",
     "name": "stdout",
     "text": [
      "***********************************************************\n",
      "Methods: LiNGAM and PC\n",
      "SHD_CPDAG = 25.000000\n",
      "SHD = 24.000000\n",
      "SID_CPDAG = [13.000000, 13.000000]\n",
      "SID = 13.000000\n",
      "***********************************************************\n",
      "Methods: LiNGAM and GES\n",
      "SHD_CPDAG = 33.000000\n",
      "SHD = 33.000000\n",
      "SID_CPDAG = [10.000000, 13.000000]\n",
      "SID = 13.000000\n",
      "***********************************************************\n",
      "Methods: PC and GES\n",
      "SHD_CPDAG = 22.000000\n",
      "SHD = 22.000000\n",
      "SID_CPDAG = [70.000000, 78.000000]\n",
      "SID = 78.000000\n"
     ]
    }
   ],
   "source": [
    "import itertools\n",
    "from numpy.random import randint\n",
    "from cdt.metrics import SHD, SHD_CPDAG, SID, SID_CPDAG\n",
    "\n",
    "# Find combinations of pair of methods to compare\n",
    "combinations = list(itertools.combinations(graphs_nx, 2))\n",
    "\n",
    "for pair in combinations:\n",
    "    print(\"***********************************************************\")\n",
    "    graph1 = graphs_nx[pair[0]]\n",
    "    graph2 = graphs_nx[pair[1]]\n",
    "    print(\"Methods: %s and %s\"%(pair[0], pair[1]))\n",
    "    print(\"SHD_CPDAG = %f\"%(SHD_CPDAG(graph1, graph2)))\n",
    "    print(\"SHD = %f\"%(SHD(graph1, graph2, double_for_anticausal=False)))\n",
    "    print(\"SID_CPDAG = [%f, %f]\"%(SID_CPDAG(graph1, graph2)))\n",
    "    print(\"SID = %f\"%(SID(graph1, graph2)))"
   ]
  },
  {
   "source": [
    "The values for the metrics show how different the graphs are from each other. A higher distance value implies that the difference between the graphs is more."
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ]
}